﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.IO;

namespace XML.Ultils
{
    public class Ultil
    {

        public List<Recipes> ListRecipes(XmlDocument document)
        {
            List<Recipes> ListRecipes = new List<Recipes>();
            
            XmlNodeList nodes = document.DocumentElement.ChildNodes;
            foreach (XmlNode childnode in nodes)
            {
                Recipes recipes = new Recipes();
                foreach (XmlNode node in childnode.ChildNodes)
                {
                    switch (node.Name)
                    {
                        case "NAME":
                            {
                                recipes.setNAME(node.InnerText);
                                break;
                            }
                        case "VERSION":
                            {
                                int version = 0;
                                try
                                {
                                    version = Convert.ToInt32(node.InnerText);
                                }
                                catch (Exception) { }
                                recipes.setVERSION(version);
                                break;
                            }
                        case "TYPE":
                            {
                                recipes.setTYPE(node.InnerText);
                                break;
                            }
                        case "BREWER":
                            {
                                recipes.setBREWER(node.InnerText);
                                break;
                            }
                        case "ASST_BREWER":
                            {
                                recipes.setASST_BREWER(node.InnerText);
                                break;
                            }
                        case "BATCH_SIZE":
                            {
                                recipes.setBATCH_SIZE(node.InnerText);
                                break;
                            }
                        case "BOIL_SIZE":
                            {
                                float boil_size = 0;
                                try
                                {
                                    boil_size = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                recipes.setBOIL_SIZE(boil_size);
                                break;
                            }
                        case "BOIL_TIME":
                            {
                                int boil_time = 0;
                                try
                                {
                                    boil_time = Convert.ToInt32(node.InnerText);
                                }
                                catch (Exception) { }
                                recipes.setBOIL_TIME(boil_time);
                                break;
                            }
                        case "EFFICIENCY":
                            {
                                float efficiency = 0;
                                try
                                {
                                    efficiency = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                recipes.setEFFICIENCY(efficiency);
                                break;
                            }
                        case "HOPS":
                            {
                                listHops HOPS = new listHops();
                                List<Hops> ListHops = new List<Hops>();
                                foreach (XmlNode hopsnode in node.ChildNodes)
                                {
                                    Hops hops = new Hops();
                                    foreach (XmlNode hop in hopsnode.ChildNodes)
                                    {
                                        switch (hop.Name)
                                        {
                                            case "NAME":
                                                {
                                                    hops.setNAME(hop.InnerText);
                                                    break;
                                                }
                                            case "VERSION":
                                                {
                                                    int version = 0;
                                                    try
                                                    {
                                                        version = Convert.ToInt32(hop.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    hops.setVERSION(version);
                                                    break;
                                                }
                                            case "ORIGIN":
                                                {
                                                    hops.setORIGIN(hop.InnerText);
                                                    break;
                                                }
                                            case "ALPHA":
                                                {
                                                    float alpha = 0;
                                                    try
                                                    {
                                                        alpha = float.Parse(hop.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    hops.setALPHA(alpha);
                                                    break;
                                                }
                                            case "AMOUNT":
                                                {
                                                    float amount = 0;
                                                    try
                                                    {
                                                        amount = float.Parse(hop.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    hops.setAMOUNT(amount);
                                                    break;
                                                }
                                            case "USE":
                                                {
                                                    hops.setUSE(hop.InnerText);
                                                    break;
                                                }
                                            case "TIME":
                                                {
                                                    float time = 0;
                                                    try
                                                    {
                                                        time = float.Parse(hop.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    hops.setTIME(time);
                                                    break;
                                                }
                                            case "NOTES":
                                                {
                                                    hops.setNOTES(hop.InnerText);
                                                    break;
                                                }
                                            case "TYPE":
                                                {
                                                    hops.setTYPE(hop.InnerText);
                                                    break;
                                                }
                                            case "FORM":
                                                {
                                                    hops.setFORM(hop.InnerText);
                                                    break;
                                                }
                                            case "BETA":
                                                {
                                                    float beta = 0;
                                                    try
                                                    {
                                                        beta = float.Parse(hop.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    hops.setBETA(beta);
                                                    break;
                                                }
                                            case "HSI":
                                                {
                                                    float hsi = 0;
                                                    try
                                                    {
                                                        hsi = float.Parse(hop.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    hops.setHSI(hsi);
                                                    break;
                                                }
                                            case "DISPLAY_AMOUNT":
                                                {
                                                    hops.setDISPLAY_AMOUNT(hop.InnerText);
                                                    break;
                                                }
                                            case "INVENTORY":
                                                {
                                                    hops.setINVENTORY(hop.InnerText);
                                                    break;
                                                }
                                            case "DISPLAY_TIME":
                                                {
                                                    hops.setDISPLAY_TIME(hop.InnerText);
                                                    break;
                                                }
                                        }
                                    }
                                    ListHops.Add(hops);
                                }
                                HOPS.setHOPS(ListHops);
                                recipes.setHOPS(HOPS);
                                break;
                            }
                        case "FERMENTABLES":
                            {
                                listFermentables FERMENTABLES = new listFermentables();
                                List<Fermentables> ListFermentables = new List<Fermentables>();
                                foreach (XmlNode fermentablesnode in node.ChildNodes)
                                {
                                    Fermentables fermentables = new Fermentables();
                                    foreach (XmlNode fermentable in fermentablesnode.ChildNodes)
                                    {
                                        switch (fermentable.Name)
                                        {
                                            case "NAME":
                                                {
                                                    fermentables.setNAME(fermentable.InnerText);
                                                    break;
                                                }
                                            case "VERSION":
                                                {
                                                    int version = 0;
                                                    try
                                                    {
                                                        version = int.Parse(fermentable.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    fermentables.setVERSION(version);
                                                    break;
                                                }
                                            case "TYPE":
                                                {
                                                    fermentables.setTYPE(fermentable.InnerText);
                                                    break;
                                                }
                                            case "AMOUNT":
                                                {
                                                    float amount = 0;
                                                    try
                                                    {
                                                        amount = float.Parse(fermentable.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    fermentables.setAMOUNT(amount);
                                                    break;
                                                }
                                            case "YIELD":
                                                {
                                                    float yield = 0;
                                                    try
                                                    {
                                                        yield = float.Parse(fermentable.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    fermentables.setYIELD(yield);
                                                    break;
                                                }
                                            case "COLOR":
                                                {
                                                    float color = 0;
                                                    try
                                                    {
                                                        color = float.Parse(fermentable.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    fermentables.setCOLOR(color);
                                                    break;
                                                }
                                            case "ADD_AFTER_BOIL":
                                                {
                                                    fermentables.setADD_AFTER_BOIL(fermentable.InnerText);
                                                    break;
                                                }
                                            case "ORIGIN":
                                                {
                                                    fermentables.setORIGIN(fermentable.InnerText);
                                                    break;
                                                }
                                            case "SUPPLIER":
                                                {
                                                    fermentables.setSUPPLIER(fermentable.InnerText);
                                                    break;
                                                }
                                            case "NOTES":
                                                {
                                                    fermentables.setNOTES(fermentable.InnerText);
                                                    break;
                                                }
                                            case "COARSE_FINE_DIFF":
                                                {
                                                    float coarse_fine_dift = 0;
                                                    try
                                                    {
                                                        coarse_fine_dift = float.Parse(fermentable.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    fermentables.setCOARSE_FINE_DIFF(coarse_fine_dift);
                                                    break;
                                                }
                                            case "MOISTURE":
                                                {
                                                    float moisture = 0;
                                                    try
                                                    {
                                                        moisture = float.Parse(fermentable.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    fermentables.setMOISTURE(moisture);
                                                    break;
                                                }
                                            case "DIASTATIC_POWER":
                                                {
                                                    float diastatic_power = 0;
                                                    try
                                                    {
                                                        diastatic_power = float.Parse(fermentable.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    fermentables.setDIASTATIC_POWER(diastatic_power);
                                                    break;
                                                }
                                            case "PROTEIN":
                                                {
                                                    float protein = 0;
                                                    try
                                                    {
                                                        protein = float.Parse(fermentable.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    fermentables.setPROTEIN(protein);
                                                    break;
                                                }
                                            case "MAX_IN_BATCH":
                                                {
                                                    float max_in_batch = 0;
                                                    try
                                                    {
                                                        max_in_batch = float.Parse(fermentable.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    fermentables.setMAX_IN_BATCH(max_in_batch);
                                                    break;
                                                }
                                            case "RECOMMEND_MASH":
                                                {
                                                    fermentables.setRECOMMEND_MASH(fermentable.InnerText);
                                                    break;
                                                }
                                            case "IBU_GAL_PER_LB":
                                                {
                                                    float ibu_gal_per_lb = 0;
                                                    try
                                                    {
                                                        ibu_gal_per_lb = float.Parse(fermentable.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    fermentables.setIBU_GAL_PER_LB(ibu_gal_per_lb);
                                                    break;
                                                }
                                            case "DISPLAY_AMOUNT":
                                                {
                                                    fermentables.setDISPLAY_AMOUNT(fermentable.InnerText);
                                                    break;
                                                }
                                            case "INVENTORY":
                                                {
                                                    fermentables.setINVENTORY(fermentable.InnerText);
                                                    break;
                                                }
                                            case "POTENTIAL":
                                                {
                                                    float potential = 0;
                                                    try
                                                    {
                                                        potential = float.Parse(fermentable.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    fermentables.setPOTENTIAL(potential);
                                                    break;
                                                }
                                            case "DISPLAY_COLOR":
                                                {
                                                    fermentables.setDISPLAY_COLOR(fermentable.InnerText);
                                                    break;
                                                }
                                        }
                                    }
                                    ListFermentables.Add(fermentables);
                                }
                                FERMENTABLES.setFERMENTABLES(ListFermentables);
                                recipes.setFERMENTABLES(FERMENTABLES);
                                break;
                            }
                        case "MISCS":
                            {
                                listMiscs MISCS = new listMiscs();
                                List<Miscs> ListMiscs = new List<Miscs>();
                                foreach (XmlNode miscsnode in node.ChildNodes)
                                {
                                    Miscs miscs = new Miscs();
                                    foreach (XmlNode misc in miscsnode.ChildNodes)
                                    {
                                        switch (misc.Name)
                                        {
                                            case "NAME":
                                                {
                                                    miscs.setNAME(misc.InnerText);
                                                    break;
                                                }
                                            case "VERSION":
                                                {
                                                    int version = 0;
                                                    try
                                                    {
                                                        version = Convert.ToInt32(misc.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    miscs.setVERSION(version);
                                                    break;
                                                }
                                            case "TYPE":
                                                {
                                                    miscs.setTYPE(misc.InnerText);
                                                    break;
                                                }
                                            case "USE":
                                                {
                                                    miscs.setUSE(misc.InnerText);
                                                    break;
                                                }
                                            case "AMOUNT":
                                                {
                                                    float amount = 0;
                                                    try
                                                    {
                                                        amount = float.Parse(misc.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    miscs.setAMOUNT(amount);
                                                    break;
                                                }
                                            case "TIME":
                                                {
                                                    float time = 0;
                                                    try
                                                    {
                                                        time = float.Parse(misc.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    miscs.setTIME(time);
                                                    break;
                                                }
                                            case "AMOUNT_IS_WEIGHT":
                                                {
                                                    miscs.setAMOUNT_IS_WEIGHT(misc.InnerText);
                                                    break;
                                                }
                                            case "USE_FOR":
                                                {
                                                    miscs.setUSE_FOR(misc.InnerText);
                                                    break;
                                                }
                                            case "NOTES":
                                                {
                                                    miscs.setNOTES(misc.InnerText);
                                                    break;
                                                }
                                            case "DISPLAY_AMOUNT":
                                                {
                                                    miscs.setDISPLAY_AMOUNT(misc.InnerText);
                                                    break;
                                                }
                                            case "INVENTORY":
                                                {
                                                    miscs.setINVENTORY(misc.InnerText);
                                                    break;
                                                }
                                            case "DISPLAY_TIME":
                                                {
                                                    miscs.setDISPLAY_TIME(misc.InnerText);
                                                    break;
                                                }
                                        }
                                    }
                                    ListMiscs.Add(miscs);
                                }
                                MISCS.setMISCS(ListMiscs);
                                recipes.setMISCS(MISCS);
                                break;
                            }
                        case "YEASTS":
                            {
                                listYeasts YEASTS = new listYeasts();
                                List<Yeast> ListYeasts = new List<Yeast>();
                                foreach (XmlNode yeastsnode in node.ChildNodes)
                                {
                                    Yeast yeasts = new Yeast();
                                    foreach (XmlNode yeast in yeastsnode.ChildNodes)
                                    {
                                        switch (yeast.Name)
                                        {
                                            case "NAME":
                                                {
                                                    yeasts.setNAME(yeast.InnerText);
                                                    break;
                                                }
                                            case "VERSION":
                                                {
                                                    int version = 0;
                                                    try
                                                    {
                                                        version = Convert.ToInt32(yeast.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    yeasts.setVERSION(version);
                                                    break;
                                                }
                                            case "TYPE":
                                                {
                                                    yeasts.setTYPE(yeast.InnerText);
                                                    break;
                                                }
                                            case "FORM":
                                                {
                                                    yeasts.setFORM(yeast.InnerText);
                                                    break;
                                                }
                                            case "AMOUNT":
                                                {
                                                    float amount = 0;
                                                    try
                                                    {
                                                        amount = float.Parse(yeast.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    yeasts.setAMOUNT(amount);
                                                    break;
                                                }
                                            case "AMOUNT_IS_WEIGHT":
                                                {
                                                    yeasts.setAMOUNT_IS_WEIGHT(yeast.InnerText);
                                                    break;
                                                }
                                            case "LABORATORY":
                                                {
                                                    yeasts.setLABORATORY(yeast.InnerText);
                                                    break;
                                                }
                                            case "PRODUCT_ID":
                                                {
                                                    yeasts.setPRODUCT_ID(yeast.InnerText);
                                                    break;
                                                }
                                            case "MIN_TEMPERATURE":
                                                {
                                                    float min_temperature = 0;
                                                    try
                                                    {
                                                        min_temperature = float.Parse(yeast.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    yeasts.setMIN_TEMPERATURE(min_temperature);
                                                    break;
                                                }
                                            case "MAX_TEMPERATURE":
                                                {
                                                    float max_temperature = 0;
                                                    try
                                                    {
                                                        max_temperature = float.Parse(yeast.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    yeasts.setMAX_TEMPERATURE(max_temperature);
                                                    break;
                                                }
                                            case "FLOCCULATION":
                                                {
                                                    yeasts.setFLOCCULATION(yeast.InnerText);
                                                    break;
                                                }
                                            case "ATTENUATION":
                                                {
                                                    float attenuation = 0;
                                                    try
                                                    {
                                                        attenuation = float.Parse(yeast.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    yeasts.setATTENUATION(attenuation);
                                                    break;
                                                }
                                            case "NOTES":
                                                {
                                                    yeasts.setNOTES(yeast.InnerText);
                                                    break;
                                                }
                                            case "BEST_FOR":
                                                {
                                                    yeasts.setBEST_FOR(yeast.InnerText);
                                                    break;
                                                }
                                            case "MAX_REUSE":
                                                {
                                                    int max_reuse = 0;
                                                    try
                                                    {
                                                        max_reuse = int.Parse(yeast.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    yeasts.setMAX_REUSE(max_reuse);
                                                    break;
                                                }
                                            case "TIMES_CULTURED":
                                                {
                                                    int time_cultured = 0;
                                                    try
                                                    {
                                                        time_cultured = int.Parse(yeast.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    yeasts.setTIMES_CULTURED(time_cultured);
                                                    break;
                                                }
                                            case "ADD_TO_SECONDARY":
                                                {
                                                    yeasts.setADD_TO_SECONDARY(yeast.InnerText);
                                                    break;
                                                }
                                            case "DISPLAY_AMOUNT":
                                                {
                                                    yeasts.setDISPLAY_AMOUNT(yeast.InnerText);
                                                    break;
                                                }
                                            case "DISP_MIN_TEMP":
                                                {
                                                    yeasts.setDISP_MIN_TEMP(yeast.InnerText);
                                                    break;
                                                }
                                            case "DISP_MAX_TEMP":
                                                {
                                                    yeasts.setDISP_MAX_TEMP(yeast.InnerText);
                                                    break;
                                                }
                                            case "INVENTORY":
                                                {
                                                    yeasts.setINVENTORY(yeast.InnerText);
                                                    break;
                                                }
                                            case "CULTURE_DATE":
                                                {
                                                    yeasts.setCULTURE_DATE(yeast.InnerText);
                                                    break;
                                                }
                                        }
                                    }
                                    ListYeasts.Add(yeasts);
                                }
                                YEASTS.setYEASTS(ListYeasts);
                                recipes.setYEAST(YEASTS);
                                break;
                            }
                        case "WATERS":
                            {
                                listWaters WATERS = new listWaters();
                                List<Waters> ListWaters = new List<Waters>();
                                foreach (XmlNode watersnode in node.ChildNodes)
                                {
                                    Waters waters = new Waters();
                                    foreach (XmlNode water in watersnode.ChildNodes)
                                    {
                                        switch (water.Name)
                                        {
                                            case "NAME":
                                                {
                                                    waters.setNAME(water.InnerText);
                                                    break;
                                                }
                                            case "VERSION":
                                                {
                                                    int version = 0;
                                                    try
                                                    {
                                                        version = Convert.ToInt32(water.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    waters.setVERSION(version);
                                                    break;
                                                }
                                            case "AMOUNT":
                                                {
                                                    float amount = 0;
                                                    try
                                                    {
                                                        amount = float.Parse(water.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    waters.setAMOUNT(amount);
                                                    break;
                                                }
                                            case "CALCIUM":
                                                {
                                                    float calcium = 0;
                                                    try
                                                    {
                                                        calcium = float.Parse(water.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    waters.setCALCIUM(calcium);
                                                    break;
                                                }
                                            case "BICARBONATE":
                                                {
                                                    float bicarbonate = 0;
                                                    try
                                                    {
                                                        bicarbonate = float.Parse(water.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    waters.setBICARBONATE(bicarbonate);
                                                    break;
                                                }
                                            case "SULFATE":
                                                {
                                                    float sulfate = 0;
                                                    try
                                                    {
                                                        sulfate = float.Parse(water.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    waters.setSULFATE(sulfate);
                                                    break;
                                                }
                                            case "CHLORIDE":
                                                {
                                                    float chloride = 0;
                                                    try
                                                    {
                                                        chloride = float.Parse(water.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    waters.setCHLORIDE(chloride);
                                                    break;
                                                }
                                            case "SODIUM":
                                                {
                                                    float sodium = 0;
                                                    try
                                                    {
                                                        sodium = float.Parse(water.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    waters.setSODIUM(sodium);
                                                    break;
                                                }
                                            case "MAGNESIUM":
                                                {
                                                    float magnesium = 0;
                                                    try
                                                    {
                                                        magnesium = float.Parse(water.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    waters.setMAGNESIUM(magnesium);
                                                    break;
                                                }
                                            case "PH":
                                                {
                                                    float ph = 0;
                                                    try
                                                    {
                                                        ph = float.Parse(water.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    waters.setPH(ph);
                                                    break;
                                                }
                                            case "NOTES":
                                                {
                                                    waters.setNOTES(water.InnerText);
                                                    break;
                                                }
                                            case "DISPLAY_AMOUNT":
                                                {
                                                    waters.setDISPLAY_AMOUNT(water.InnerText);
                                                    break;
                                                }
                                        }
                                    }
                                    ListWaters.Add(waters);
                                }
                                WATERS.setWATERS(ListWaters);
                                recipes.setWATERS(WATERS);
                                break;
                            }
                        case "STYLE":
                            {
                                Styles Styles = new Styles();
                                foreach (XmlNode stylesnode in node.ChildNodes)
                                {
                                    switch (stylesnode.Name)
                                    {
                                        case "NAME":
                                            {
                                                Styles.setNAME(stylesnode.InnerText);
                                                break;
                                            }
                                        case "VERSION":
                                            {
                                                int version = 0;
                                                try
                                                {
                                                    version = Convert.ToInt32(stylesnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Styles.setVERSION(version);
                                                break;
                                            }
                                        case "CATEGORY":
                                            {
                                                Styles.setCATEGORY(stylesnode.InnerText);
                                                break;
                                            }
                                        case "CATEGORY_NUMBER":
                                            {
                                                int category_number = 0;
                                                try
                                                {
                                                    category_number = Convert.ToInt32(stylesnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Styles.setCATEGORY_NUMBER(category_number);
                                                break;
                                            }
                                        case "STYLE_LETTER":
                                            {
                                                Styles.setSTYLE_LETTER(stylesnode.InnerText);
                                                break;
                                            }
                                        case "STYLE_GUIDE":
                                            {
                                                Styles.setSTYLE_GUIDE(stylesnode.InnerText);
                                                break;
                                            }
                                        case "TYPE":
                                            {
                                                Styles.setTYPE(stylesnode.InnerText);
                                                break;
                                            }
                                        case "OG_MIN":
                                            {
                                                float og_min = 0;
                                                try
                                                {
                                                    og_min = float.Parse(stylesnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Styles.setOG_MIN(og_min);
                                                break;
                                            }
                                        case "OG_MAX":
                                            {
                                                float og_max = 0;
                                                try
                                                {
                                                    og_max = float.Parse(stylesnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Styles.setOG_MAX(og_max);
                                                break;
                                            }
                                        case "FG_MIN":
                                            {
                                                float fg_min = 0;
                                                try
                                                {
                                                    fg_min = float.Parse(stylesnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Styles.setFG_MIN(fg_min);
                                                break;
                                            }
                                        case "FG_MAX":
                                            {
                                                float fg_max = 0;
                                                try
                                                {
                                                    fg_max = float.Parse(stylesnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Styles.setFG_MAX(fg_max);
                                                break;
                                            }
                                        case "IBU_MIN":
                                            {
                                                float ibu_min = 0;
                                                try
                                                {
                                                    ibu_min = float.Parse(stylesnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Styles.setIBU_MIN(ibu_min);
                                                break;
                                            }
                                        case "IBU_MAX":
                                            {
                                                float ibu_max = 0;
                                                try
                                                {
                                                    ibu_max = float.Parse(stylesnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Styles.setIBU_MAX(ibu_max);
                                                break;
                                            }
                                        case "COLOR_MIN":
                                            {
                                                float color_min = 0;
                                                try
                                                {
                                                    color_min = float.Parse(stylesnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Styles.setCOLOR_MIN(color_min);
                                                break;
                                            }
                                        case "COLOR_MAX":
                                            {
                                                float color_max = 0;
                                                try
                                                {
                                                    color_max = float.Parse(stylesnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Styles.setCOLOR_MAX(color_max);
                                                break;
                                            }
                                        case "CARB_MIN":
                                            {
                                                float carb_min = 0;
                                                try
                                                {
                                                    carb_min = float.Parse(stylesnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Styles.setCARB_MIN(carb_min);
                                                break;
                                            }
                                        case "CARB_MAX":
                                            {
                                                float carb_max = 0;
                                                try
                                                {
                                                    carb_max = float.Parse(stylesnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Styles.setCARB_MAX(carb_max);
                                                break;
                                            }
                                        case "ABV_MAX":
                                            {
                                                float abv_max = 0;
                                                try
                                                {
                                                    abv_max = float.Parse(stylesnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Styles.setABV_MAX(abv_max);
                                                break;
                                            }
                                        case "ABV_MIN":
                                            {
                                                float abv_min = 0;
                                                try
                                                {
                                                    abv_min = float.Parse(stylesnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Styles.setABV_MIN(abv_min);
                                                break;
                                            }
                                        case "NOTES":
                                            {
                                                Styles.setNOTES(stylesnode.InnerText);
                                                break;
                                            }
                                        case "PROFILE":
                                            {
                                                Styles.setPROFILE(stylesnode.InnerText);
                                                break;
                                            }
                                        case "INGREDIENTS":
                                            {
                                                Styles.setINGREDIENTS(stylesnode.InnerText);
                                                break;
                                            }
                                        case "EXAMPLES":
                                            {
                                                Styles.setEXAMPLES(stylesnode.InnerText);
                                                break;
                                            }
                                        case "DISPLAY_OG_MIN":
                                            {
                                                Styles.setDISPLAY_OG_MIN(stylesnode.InnerText);
                                                break;
                                            }
                                        case "DISPLAY_OG_MAX":
                                            {
                                                Styles.setDISPLAY_OG_MAX(stylesnode.InnerText);
                                                break;
                                            }
                                        case "DISPLAY_FG_MIN":
                                            {
                                                Styles.setDISPLAY_FG_MIN(stylesnode.InnerText);
                                                break;
                                            }
                                        case "DISPLAY_FG_MAX":
                                            {
                                                Styles.setDISPLAY_FG_MAX(stylesnode.InnerText);
                                                break;
                                            }
                                        case "DISPLAY_COLOR_MIN":
                                            {
                                                Styles.setDISPLAY_COLOR_MIN(stylesnode.InnerText);
                                                break;
                                            }
                                        case "DISPLAY_COLOR_MAX":
                                            {
                                                Styles.setDISPLAY_COLOR_MAX(stylesnode.InnerText);
                                                break;
                                            }
                                        case "OG_RANGE":
                                            {
                                                Styles.setOG_RANGE(stylesnode.InnerText);
                                                break;
                                            }
                                        case "FG_RANGE":
                                            {
                                                Styles.setFG_RANGE(stylesnode.InnerText);
                                                break;
                                            }
                                        case "IBU_RANGE":
                                            {
                                                Styles.setIBU_RANGE(stylesnode.InnerText);
                                                break;
                                            }
                                        case "COLOR_RANGE":
                                            {
                                                Styles.setCOLOR_RANGE(stylesnode.InnerText);
                                                break;
                                            }
                                        case "ABV_RANGE":
                                            {
                                                Styles.setABV_RANGE(stylesnode.InnerText);
                                                break;
                                            }
                                        
                                    }
                                }
                                recipes.setSTYLES(Styles);
                                break;
                            }
                        case "EQUIPMENT":
                            {
                                Equipments Equipments = new Equipments();
                                foreach (XmlNode equipmentsnode in node.ChildNodes)
                                {
                                    switch (equipmentsnode.Name)
                                    {
                                        case "NAME":
                                            {
                                                Equipments.setNAME(equipmentsnode.InnerText);
                                                break;
                                            }
                                        case "VERSION":
                                            {
                                                int version = 0;
                                                try
                                                {
                                                    version = Convert.ToInt32(equipmentsnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Equipments.setVERSION(version);
                                                break;
                                            }
                                        case "BOIL_SIZE":
                                            {
                                                float boil_size = 0;
                                                try
                                                {
                                                    boil_size = float.Parse(equipmentsnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Equipments.setBOIL_SIZE(boil_size);
                                                break;
                                            }
                                        case "BATCH_SIZE":
                                            {
                                                float batch_size = 0;
                                                try
                                                {
                                                    batch_size = float.Parse(equipmentsnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Equipments.setBATCH_SIZE(batch_size);
                                                break;
                                            }
                                        case "TUN_VOLUME":
                                            {
                                                float tun_volume = 0;
                                                try
                                                {
                                                    tun_volume = float.Parse(equipmentsnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Equipments.setTUN_VOLUME(tun_volume);
                                                break;
                                            }
                                        case "TUN_WEIGHT":
                                            {
                                                float tun_weight = 0;
                                                try
                                                {
                                                    tun_weight = float.Parse(equipmentsnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Equipments.setTUN_WEIGHT(tun_weight);
                                                break;
                                            }
                                        case "TUN_SPECIFIC_HEAT":
                                            {
                                                float tun_specific_heat = 0;
                                                try
                                                {
                                                    tun_specific_heat = float.Parse(equipmentsnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Equipments.setTUN_SPECIFIC_HEAT(tun_specific_heat);
                                                break;
                                            }
                                        case "TOP_UP_WATER":
                                            {
                                                float top_up_water = 0;
                                                try
                                                {
                                                    top_up_water = float.Parse(equipmentsnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Equipments.setTOP_UP_WATER(top_up_water);
                                                break;
                                            }
                                        case "TRUB_CHILLER_LOSS":
                                            {
                                                float trub_chiller_loss = 0;
                                                try
                                                {
                                                    trub_chiller_loss = float.Parse(equipmentsnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Equipments.setTRUB_CHILLER_LOSS(trub_chiller_loss);
                                                break;
                                            }
                                        case "EVAP_RATE":
                                            {
                                                float evap_rate = 0;
                                                try
                                                {
                                                    evap_rate = float.Parse(equipmentsnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Equipments.setEVAP_RATE(evap_rate);
                                                break;
                                            }
                                        case "BOIL_TIME":
                                            {
                                                float boil_time = 0;
                                                try
                                                {
                                                    boil_time = float.Parse(equipmentsnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Equipments.setBOIL_TIME(boil_time);
                                                break;
                                            }
                                        case "CALC_BOIL_VOLUME":
                                            {
                                                Equipments.setCALC_BOIL_VOLUME(equipmentsnode.InnerText);
                                                break;
                                            }
                                        case "LAUTER_DEADSPACE":
                                            {
                                                float lauter_deadspace = 0;
                                                try
                                                {
                                                    lauter_deadspace = float.Parse(equipmentsnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Equipments.setLAUTER_DEADSPACE(lauter_deadspace);
                                                break;
                                            }
                                        case "TOP_UP_KETTLE":
                                            {
                                                float top_up_kettle = 0;
                                                try
                                                {
                                                    top_up_kettle = float.Parse(equipmentsnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Equipments.setTOP_UP_KETTLE(top_up_kettle);
                                                break;
                                            }
                                        case "HOP_UTILIZATION":
                                            {
                                                Equipments.setHOP_UTILIZATION(equipmentsnode.InnerText);
                                                break;
                                            }
                                        case "NOTES":
                                            {
                                                Equipments.setNOTES(equipmentsnode.InnerText);
                                                break;
                                            }
                                        case "DISPLAY_BOIL_SIZE":
                                            {
                                                Equipments.setDISPLAY_BOIL_SIZE(equipmentsnode.InnerText);
                                                break;
                                            }
                                        case "DISPLAY_BATCH_SIZE":
                                            {
                                                Equipments.setDISPLAY_BATCH_SIZE(equipmentsnode.InnerText);
                                                break;
                                            }
                                        case "DISPLAY_TUN_VOLUME":
                                            {
                                                Equipments.setDISPLAY_TUN_VOLUME(equipmentsnode.InnerText);
                                                break;
                                            }
                                        case "DISPLAY_TUN_WEIGHT":
                                            {
                                                Equipments.setDISPLAY_TUN_WEIGHT(equipmentsnode.InnerText);
                                                break;
                                            }
                                        case "DISPLAY_TOP_UP_WATER":
                                            {
                                                Equipments.setDISPLAY_TOP_UP_WATER(equipmentsnode.InnerText);
                                                break;
                                            }
                                        case "DISPLAY_TRUB_CHILLER_LOSS":
                                            {
                                                Equipments.setDISPLAY_TRUB_CHILLER_LOSS(equipmentsnode.InnerText);
                                                break;
                                            }
                                        case "DISPLAY_LAUTER_DEADSPACE":
                                            {
                                                Equipments.setDISPLAY_LAUTER_DEADSPACE(equipmentsnode.InnerText);
                                                break;
                                            }
                                        case "DISPLAY_TOP_UP_KETTLE":
                                            {
                                                Equipments.setDISPLAY_TOP_UP_KETTLE(equipmentsnode.InnerText);
                                                break;
                                            }

                                    }
                                }
                                recipes.setEQUIPMENTS(Equipments);
                                break;
                            }
                        case "MASH":
                            {
                                Mashs Mashs = new Mashs();
                                foreach (XmlNode mashsnode in node.ChildNodes)
                                {
                                    switch (mashsnode.Name)
                                    {
                                        case "NAME":
                                            {
                                                Mashs.setNAME(mashsnode.InnerText);
                                                break;
                                            }
                                        case "VERSION":
                                            {
                                                int version = 0;
                                                try
                                                {
                                                    version = Convert.ToInt32(mashsnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Mashs.setVERSION(version);
                                                break;
                                            }
                                        case "GRAIN_TEMP":
                                            {
                                                float grain_temp = 0;
                                                try
                                                {
                                                    grain_temp = float.Parse(mashsnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Mashs.setGRAIN_TEMP(grain_temp);
                                                break;
                                            }
                                        case "TUN_TEMP":
                                            {
                                                float tun_temp = 0;
                                                try
                                                {
                                                    tun_temp = float.Parse(mashsnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Mashs.setTUN_TEMP(tun_temp);
                                                break;
                                            }
                                        case "SPARGE_TEMP":
                                            {
                                                float sparge = 0;
                                                try
                                                {
                                                    sparge = float.Parse(mashsnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Mashs.setSPARGE_TEMP(sparge);
                                                break;
                                            }
                                        case "PH":
                                            {
                                                float ph = 0;
                                                try
                                                {
                                                    ph = float.Parse(mashsnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Mashs.setPH(ph);
                                                break;
                                            }
                                        case "TUN_WEIGHT":
                                            {
                                                float tun_weight = 0;
                                                try
                                                {
                                                    tun_weight = float.Parse(mashsnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Mashs.setTUN_WEIGHT(tun_weight);
                                                break;
                                            }
                                        case "TUN_SPECIFIC_HEAT":
                                            {
                                                float tun_specific_heat = 0;
                                                try
                                                {
                                                    tun_specific_heat = float.Parse(mashsnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Mashs.setTUN_SPECIFIC_HEAT(tun_specific_heat);
                                                break;
                                            }
                                        case "EQUIP_ADJUST":
                                            {
                                                Mashs.setEQUIP_ADJUST(mashsnode.InnerText);
                                                break;
                                            }
                                        case "NOTES":
                                            {
                                                Mashs.setNOTES(mashsnode.InnerText);
                                                break;
                                            }
                                        case "DISPLAY_GRAIN_TEMP":
                                            {
                                                Mashs.setDISPLAY_GRAIN_TEMP(mashsnode.InnerText);
                                                break;
                                            }
                                        case "DISPLAY_TUN_TEMP":
                                            {
                                                float display_tun_temp = 0;
                                                try
                                                {
                                                    display_tun_temp = float.Parse(mashsnode.InnerText);
                                                }
                                                catch (Exception) { }
                                                Mashs.setDISPLAY_TUN_TEMP(display_tun_temp);
                                                break;
                                            }
                                        case "DISPLAY_SPARGE_TEMP":
                                            {
                                                Mashs.setDISPLAY_SPARGE_TEMP(mashsnode.InnerText);
                                                break;
                                            }
                                        case "DISPLAY_TUN_WEIGHT":
                                            {
                                                Mashs.setDISPLAY_TUN_WEIGHT(mashsnode.InnerText);
                                                break;
                                            }
                                        case "MASH_STEPS":
                                            {
                                                listMashStep MASH_STEP = new listMashStep();
                                                List<Mash_step> ListMash_Step = new List<Mash_step>();
                                                foreach (XmlNode mash_stepnode in mashsnode.ChildNodes)
                                                {
                                                    Mash_step mash_step = new Mash_step();
                                                    foreach (XmlNode step in mash_stepnode.ChildNodes)
                                                    {
                                                        switch (step.Name)
                                                        {
                                                            case "NAME":
                                                                {
                                                                    mash_step.setNAME(step.InnerText);
                                                                    break;
                                                                }
                                                            case "VERSION":
                                                                {
                                                                    int x = 0;
                                                                    try
                                                                    {
                                                                        x = int.Parse(step.InnerText);
                                                                    }
                                                                    catch (Exception) { }
                                                                    mash_step.setVERSION(x);
                                                                    break;
                                                                }
                                                            case "TYPE":
                                                                {
                                                                    mash_step.setTYPE(step.InnerText);
                                                                    break;
                                                                }
                                                            case "INFUSE_AMOUNT":
                                                                {
                                                                    float x = 0;
                                                                    try
                                                                    {
                                                                        x = float.Parse(step.InnerText);
                                                                    }
                                                                    catch (Exception) { }
                                                                    mash_step.setINFUSE_AMOUNT(x);
                                                                    break;
                                                                }
                                                            case "STEP_TIME":
                                                                {
                                                                    int x = 0;
                                                                    try
                                                                    {
                                                                        x = int.Parse(step.InnerText);
                                                                    }
                                                                    catch (Exception) { }
                                                                    mash_step.setSTEP_TIME(x);
                                                                    break;
                                                                }
                                                            case "STEP_TEMP":
                                                                {
                                                                    int x = 0;
                                                                    try
                                                                    {
                                                                        x = int.Parse(step.InnerText);
                                                                    }
                                                                    catch (Exception) { }
                                                                    mash_step.setSTEP_TEMP(x);
                                                                    break;
                                                                }
                                                            case "RAMP_TIME":
                                                                {
                                                                    int x = 0;
                                                                    try
                                                                    {
                                                                        x = int.Parse(step.InnerText);
                                                                    }
                                                                    catch (Exception) { }
                                                                    mash_step.setRAMP_TIME(x);
                                                                    break;
                                                                }
                                                            case "END_TEMP":
                                                                {
                                                                    float x = 0;
                                                                    try
                                                                    {
                                                                        x = float.Parse(step.InnerText);
                                                                    }
                                                                    catch (Exception) { }
                                                                    mash_step.setEND_TEMP(x);
                                                                    break;
                                                                }
                                                            case "DESCRIPTION":
                                                                {
                                                                    mash_step.setDESCRIPTION(step.InnerText);
                                                                    break;
                                                                }
                                                            case "WATER_GRAIN_RATIO":
                                                                {
                                                                    float x = 0;
                                                                    try
                                                                    {
                                                                        x = float.Parse(step.InnerText);
                                                                    }
                                                                    catch (Exception) { }
                                                                    mash_step.setWATER_GRAIN_RATIO(x);
                                                                    break;
                                                                }
                                                            case "DECOCTION_AMT":
                                                                {
                                                                    mash_step.setDECOCTION_AMT(step.InnerText);
                                                                    break;
                                                                }
                                                            case "INFUSE_TEMP":
                                                                {
                                                                    mash_step.setINFUSE_TEMP(step.InnerText);
                                                                    break;
                                                                }
                                                            case "DISPLAY_STEP_TEMP":
                                                                {
                                                                    mash_step.setDISPLAY_STEP_TEMP(step.InnerText);
                                                                    break;
                                                                }
                                                            case "DISPLAY_INFUSE_AMT":
                                                                {
                                                                    mash_step.setDISPLAY_INFUSE_AMT(step.InnerText);
                                                                    break;
                                                                }
                                                        }
                                                    }
                                                    ListMash_Step.Add(mash_step);
                                                }
                                                MASH_STEP.setMASH_STEP(ListMash_Step);
                                                Mashs.setMASH_STEPS(MASH_STEP);
                                                break;
                                            }
                                    }
                                }
                                recipes.setMASHS(Mashs);
                                break;
                            }
                        case "NOTES":
                            {
                                recipes.setNOTES(node.InnerText);
                                break;
                            }
                        case "TASTE_NOTES":
                            {
                                recipes.setTASTE_NOTES(node.InnerText);
                                break;
                            }
                        case "TASTE_RATING":
                            {
                                float taste_rating = 0;
                                try
                                {
                                    taste_rating = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                recipes.setTASTE_RATING(taste_rating);
                                break;
                            }
                        case "OG":
                            {
                                recipes.setOG(node.InnerText);
                                break;
                            }
                        case "FG":
                            {
                                recipes.setFG(node.InnerText);
                                break;
                            }
                        case "CARBONATION":
                            {
                                float carbonation = 0;
                                try
                                {
                                    carbonation = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                recipes.setCARBONATION(carbonation);
                                break;
                            }
                        case "FERMENTATION_STAGES":
                            {
                                int fermentation_stages = 0;
                                try
                                {
                                    fermentation_stages = Convert.ToInt32(node.InnerText);
                                }
                                catch (Exception) { }
                                recipes.setFERMENTATION_STAGES(fermentation_stages);
                                break;
                            }
                        case "PRIMARY_AGE":
                            {
                                int primary_age = 0;
                                try
                                {
                                    primary_age = Convert.ToInt32(node.InnerText);
                                }
                                catch (Exception) { }
                                recipes.setPRIMARY_AGE(primary_age);
                                break;
                            }
                        case "PRIMARY_TEMP":
                            {
                                int primary_temp = 0;
                                try
                                {
                                    primary_temp = Convert.ToInt32(node.InnerText);
                                }
                                catch (Exception) { }
                                recipes.setPRIMARY_TEMP(primary_temp);
                                break;
                            }
                        case "SECONDARY_AGE":
                            {
                                int secondary_age = 0;
                                try
                                {
                                    secondary_age = Convert.ToInt32(node.InnerText);
                                }
                                catch (Exception) { }
                                recipes.setSECONDARY_AGE(secondary_age);
                                break;
                            }
                        case "SECONDARY_TEMP":
                            {
                                float secondary_temp = 0;
                                try
                                {
                                    secondary_temp = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                recipes.setSECONDARY_TEMP(secondary_temp);
                                break;
                            }
                        case "TERTIARY_AGE":
                            {
                                int tertiary = 0;
                                try
                                {
                                    tertiary = Convert.ToInt32(node.InnerText);
                                }
                                catch (Exception) { }
                                recipes.setTERTIARY_AGE(tertiary);
                                break;
                            }
                        case "AGE":
                            {
                                recipes.setAGE(node.InnerText);
                                break;
                            }
                        case "AGE_TEMP":
                            {
                                float age_temp = 0;
                                try
                                {
                                    age_temp = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                recipes.setAGE_TEMP(age_temp);
                                break;
                            }
                        case "CARBONATION_USED":
                            {
                                recipes.setCARBONATION_USED(node.InnerText);
                                break;
                            }
                        case "DATE":
                            {
                                recipes.setDATE(node.InnerText);
                                break;
                            }
                        case "EST_OG":
                            {
                                recipes.setEST_OG(node.InnerText);
                                break;
                            }
                        case "EST_FG":
                            {
                                recipes.setEST_FG(node.InnerText);
                                break;
                            }
                        case "EST_COLOR":
                            {
                                recipes.setEST_COLOR(node.InnerText);
                                break;
                            }
                        case "IBU":
                            {
                                recipes.setIBU(node.InnerText);
                                break;
                            }
                        case "IBU_METHOD":
                            {
                                recipes.setIBU_METHOD(node.InnerText);
                                break;
                            }
                        case "EST_ABV":
                            {
                                recipes.setEST_ABV(node.InnerText);
                                break;
                            }
                        case "ABV":
                            {
                                recipes.setABV(node.InnerText);
                                break;
                            }
                        case "ACTUAL_EFFICIENCY":
                            {
                                recipes.setACTUAL_EFFICIENCY(node.InnerText);
                                break;
                            }
                        case "CALORIES":
                            {
                                recipes.setCALORIES(node.InnerText);
                                break;
                            }
                        case "DISPLAY_BATCH_SIZE":
                            {
                                recipes.setDISPLAY_BATCH_SIZE(node.InnerText);
                                break;
                            }
                        case "DISPLAY_BOIL_SIZE":
                            {
                                recipes.setDISPLAY_BOIL_SIZE(node.InnerText);
                                break;
                            }
                        case "DISPLAY_OG":
                            {
                                recipes.setDISPLAY_OG(node.InnerText);
                                break;
                            }
                        case "DISPLAY_FG":
                            {
                                recipes.setDISPLAY_FG(node.InnerText);
                                break;
                            }
                        case "DISPLAY_PRIMARY_TEMP":
                            {
                                recipes.setDISPLAY_PRIMARY_TEMP(node.InnerText);
                                break;
                            }
                        case "DISPLAY_SECONDARY_TEMP":
                            {
                                recipes.setDISPLAY_SECONDARY_TEMP(node.InnerText);
                                break;
                            }
                        case "DISPLAY_TERTIARY_TEMP":
                            {
                                recipes.setDISPLAY_TERTIARY_TEMP(node.InnerText);
                                break;
                            }
                        case "DISPLAY_AGE_TEMP":
                            {
                                recipes.setDISPLAY_AGE_TEMP(node.InnerText);
                                break;
                            }
                    }

                }
                ListRecipes.Add(recipes);
            }

            return ListRecipes;
        }

        public DataTable dataTableRecipes(List<Recipes> str)
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("name", typeof(String));
            dt.Columns.Add("version", typeof(int));
            dt.Columns.Add("type", typeof(String));
            dt.Columns.Add("brewer", typeof(string));
            dt.Columns.Add("asst_brewer", typeof(string));
            dt.Columns.Add("batch_size", typeof(float));
            dt.Columns.Add("boil_size", typeof(float));
            dt.Columns.Add("boil_time", typeof(int));
            dt.Columns.Add("efficiency", typeof(float));
            dt.Columns.Add("hops", typeof(listHops));
            dt.Columns.Add("fermentables", typeof(listFermentables));
            dt.Columns.Add("miscs", typeof(listMiscs));
            dt.Columns.Add("yeasts", typeof(listYeasts));
            dt.Columns.Add("waters", typeof(listWaters));
            dt.Columns.Add("style", typeof(Styles));
            dt.Columns.Add("equipment", typeof(Equipments));
            dt.Columns.Add("mash", typeof(Mashs));
            dt.Columns.Add("notes", typeof(string));
            dt.Columns.Add("taste_notes", typeof(string));
            dt.Columns.Add("taste_rating", typeof(string));
            dt.Columns.Add("og", typeof(string));
            dt.Columns.Add("fg", typeof(string));
            dt.Columns.Add("carbonation", typeof(string));
            dt.Columns.Add("fermentation_stages", typeof(string));
            dt.Columns.Add("primary_age", typeof(string));
            dt.Columns.Add("primary_temp", typeof(string));
            dt.Columns.Add("secondary_age", typeof(string));
            dt.Columns.Add("secondary_temp", typeof(string));
            dt.Columns.Add("tertiary_age", typeof(string));
            dt.Columns.Add("age", typeof(string));
            dt.Columns.Add("age_temp", typeof(string));
            dt.Columns.Add("carbonation_used", typeof(string));
            dt.Columns.Add("date", typeof(string));
            dt.Columns.Add("est_og", typeof(string));
            dt.Columns.Add("est_fg", typeof(string));
            dt.Columns.Add("est_color", typeof(string));
            dt.Columns.Add("ibu", typeof(string));
            dt.Columns.Add("ibu_method", typeof(string));
            dt.Columns.Add("est_abv", typeof(string));
            dt.Columns.Add("abv", typeof(string));
            dt.Columns.Add("actual_efficiency", typeof(string));
            dt.Columns.Add("calories", typeof(string));
            dt.Columns.Add("display_batch_size", typeof(string));
            dt.Columns.Add("display_boil_size", typeof(string));
            dt.Columns.Add("display_og", typeof(string));
            dt.Columns.Add("display_fg", typeof(string));
            dt.Columns.Add("display_primary_temp", typeof(string));
            dt.Columns.Add("display_secondary_temp", typeof(string));
            dt.Columns.Add("display_tertiary_temp", typeof(string));
            dt.Columns.Add("display_age_temp", typeof(string));
            DataRow dr;

            for (int i = 0; i < str.Count; i++)
            {
                dr = dt.NewRow();
                dr["name"] = str[i].getNAME();
                dr["version"] = str[i].getVERSION();
                dr["type"] = str[i].getTYPE();
                dr["brewer"] = str[i].getBREWER();
                dr["asst_brewer"] = str[i].getASST_BREWER();
                dr["batch_size"] = str[i].getBATCH_SIZE();
                dr["boil_size"] = str[i].getBOIL_SIZE();
                dr["boil_time"] = str[i].getBOIL_TIME();
                dr["efficiency"] = str[i].getEFFICIENCY();
                dr["hops"] = str[i].getHOPS();
                dr["fermentables"] = str[i].getFERMENTABLES();
                dr["miscs"] = str[i].getMISCS();
                dr["yeasts"] = str[i].getYEAST();
                dr["waters"] = str[i].getWATERS();
                dr["style"] = str[i].getSTYLES();
                dr["equipment"] = str[i].getEQUIPMENTS();
                dr["mash"] = str[i].getMASHS();
                dr["notes"] = str[i].getNOTES();
                dr["taste_notes"] = str[i].getTASTE_NOTES();
                dr["taste_rating"] = str[i].getTASTE_RATING();
                dr["og"] = str[i].getOG();
                dr["fg"] = str[i].getFG();
                dr["carbonation"] = str[i].getCARBONATION();
                dr["fermentation_stages"] = str[i].getFERMENTATION_STAGES();
                dr["primary_age"] = str[i].getPRIMARY_AGE();
                dr["primary_temp"] = str[i].getPRIMARY_TEMP();
                dr["secondary_age"] = str[i].getSECONDARY_AGE();
                dr["secondary_temp"] = str[i].getSECONDARY_TEMP();
                dr["tertiary_age"] = str[i].getTERTIARY_AGE();
                dr["age"] = str[i].getAGE();
                dr["age_temp"] = str[i].getAGE_TEMP();
                dr["carbonation_used"] = str[i].getCARBONATION_USED();
                dr["date"] = str[i].getDATE();
                dr["est_og"] = str[i].getEST_OG();
                dr["est_fg"] = str[i].getEST_FG();
                dr["est_color"] = str[i].getEST_COLOR();
                dr["ibu"] = str[i].getIBU();
                dr["ibu_method"] = str[i].getIBU_METHOD();
                dr["est_abv"] = str[i].getEST_ABV();
                dr["abv"] = str[i].getABV();
                dr["actual_efficiency"] = str[i].getACTUAL_EFFICIENCY();
                dr["calories"] = str[i].getCALORIES();
                dr["display_batch_size"] = str[i].getDISPLAY_BATCH_SIZE();
                dr["display_boil_size"] = str[i].getDISPLAY_BOIL_SIZE();
                dr["display_og"] = str[i].getDISPLAY_OG();
                dr["display_fg"] = str[i].getDISPLAY_FG();
                dr["display_primary_temp"] = str[i].getDISPLAY_PRIMARY_TEMP();
                dr["display_secondary_temp"] = str[i].getDISPLAY_SECONDARY_TEMP();
                dr["display_tertiary_temp"] = str[i].getDISPLAY_TERTIARY_TEMP();
                dr["display_age_temp"] = str[i].getDISPLAY_AGE_TEMP();

                dt.Rows.Add(dr);
            }

            return dt;
        }


        public List<Fermentables> ListFermentables(XmlDocument document)
        {
            List<Fermentables> listFermentables = new List<Fermentables>();

            XmlNodeList nodes = document.DocumentElement.ChildNodes;
            foreach (XmlNode childnode in nodes)
            {
                Fermentables fermentables = new Fermentables();
                foreach (XmlNode node in childnode.ChildNodes)
                {
                    switch (node.Name)
                    {
                        case "NAME":
                            {
                                fermentables.setNAME(node.InnerText);
                                break;
                            }
                        case "VERSION":
                            {
                                int version = 0;
                                try
                                {
                                    version = Convert.ToInt32(node.InnerText);
                                }
                                catch (Exception) { }
                                fermentables.setVERSION(version);
                                break;
                            }
                        case "TYPE":
                            {
                                fermentables.setTYPE(node.InnerText);
                                break;
                            }
                        case "AMOUNT":
                            {
                                float amount = 0;
                                try
                                {
                                    amount = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                fermentables.setAMOUNT(amount);
                                break;
                            }
                        case "YIELD":
                            {
                                float yield = 0;
                                try
                                {
                                    yield = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                fermentables.setYIELD(yield);
                                break;
                            }
                        case "COLOR":
                            {
                                float color = 0;
                                try
                                {
                                    color = float.Parse(node.InnerText);
                                   
                                }
                                catch (Exception) { }
                                fermentables.setCOLOR(color);
                                break;
                            }
                        case "ADD_AFTER_BOIL":
                            {
                                fermentables.setADD_AFTER_BOIL(node.InnerText);
                                break;
                            }
                        case "ORIGIN":
                            {
                                fermentables.setORIGIN(node.InnerText);
                                break;
                            }
                        case "SUPPLIER":
                            {
                                fermentables.setSUPPLIER(node.InnerText);
                                break;
                            }
                        case "NOTES":
                            {
                                fermentables.setNOTES(node.InnerText);
                                break;
                            }
                        case "COARSE_FINE_DIFF":
                            {
                                float x = 0;
                                try
                                {
                                    x = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                fermentables.setCOARSE_FINE_DIFF(x);
                                break;
                            }
                        case "MOISTURE":
                            {
                                float x = 0;
                                try
                                {
                                    x = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                fermentables.setMOISTURE(x);
                                break;
                            }
                        case "DIASTATIC_POWER":
                            {
                                float x = 0;
                                try
                                {
                                    x = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                fermentables.setDIASTATIC_POWER(x);
                                break;
                            }
                        case "PROTEIN":
                            {
                                float x = 0;
                                try
                                {
                                    x = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                fermentables.setPROTEIN(x);
                                break;
                            }
                        case "MAX_IN_BATCH":
                            {
                                float x = 0;
                                try
                                {
                                    x = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                fermentables.setMAX_IN_BATCH(x);
                                break;
                            }
                        case "RECOMMEND_MASH":
                            {
                                fermentables.setRECOMMEND_MASH(node.InnerText);
                                break;
                            }
                        case "IBU_GAL_PER_LB":
                            {
                                float x = 0;
                                try
                                {
                                    x = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                fermentables.setIBU_GAL_PER_LB(x);
                                break;
                            }
                        case "DISPLAY_AMOUNT":
                            {
                                fermentables.setDISPLAY_AMOUNT(node.InnerText);
                                break;
                            }
                        case "INVENTORY":
                            {
                                fermentables.setINVENTORY(node.InnerText);
                                break;
                            }
                        case "POTENTIAL":
                            {
                                float potential = 0;
                                try
                                {
                                    potential = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                fermentables.setPOTENTIAL(potential);
                                break;
                            }
                        case "DISPLAY_COLOR":
                            {
                                fermentables.setDISPLAY_COLOR(node.InnerText);
                                break;
                            }
                    }

                }
                listFermentables.Add(fermentables);
            }
            return listFermentables;
        }

        public DataTable dataTableFermentables(List<Fermentables> str)
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("name", typeof(String));
            dt.Columns.Add("version", typeof(int));
            dt.Columns.Add("type", typeof(String));
            dt.Columns.Add("amount", typeof(float));
            dt.Columns.Add("yield", typeof(float));
            dt.Columns.Add("color", typeof(float));
            dt.Columns.Add("add_after_boil", typeof(String));
            dt.Columns.Add("origin", typeof(String));
            dt.Columns.Add("supplier", typeof(String));
            dt.Columns.Add("notes", typeof(String));
            dt.Columns.Add("coarse_fine_diff", typeof(String));
            dt.Columns.Add("moisture", typeof(String));
            dt.Columns.Add("diastatic_power", typeof(String));
            dt.Columns.Add("protein", typeof(String));
            dt.Columns.Add("max_in_batch", typeof(String));
            dt.Columns.Add("recommend_mash", typeof(String));
            dt.Columns.Add("ibu_gal_per_lb", typeof(String));
            dt.Columns.Add("display_amount", typeof(String));
            dt.Columns.Add("inventory", typeof(String));
            dt.Columns.Add("potential", typeof(float));
            dt.Columns.Add("display_color", typeof(String));


            dt.Columns["name"].Caption = "Fermentable";
            dt.Columns["amount"].Caption = "Amount";
            DataRow dr;

            for (int i = 0; i < str.Count; i++)
            {
                dr = dt.NewRow();
                dr["name"] = str[i].getNAME();
                dr["version"] = str[i].getVERSION();
                dr["type"] = str[i].getTYPE();
                dr["amount"] = str[i].getAMOUNT();
                dr["yield"] = str[i].getYIELD();
                dr["color"] = str[i].getCOLOR();
                dr["add_after_boil"] = str[i].getADD_AFTER_BOIL();
                dr["origin"] = str[i].getORIGIN();
                dr["supplier"] = str[i].getSUPPLIER();
                dr["notes"] = str[i].getNOTES();
                dr["coarse_fine_diff"] = str[i].getCOARSE_FINE_DIFF();
                dr["moisture"] = str[i].getMOISTURE();
                dr["diastatic_power"] = str[i].getDIASTATIC_POWER();
                dr["protein"] = str[i].getPROTEIN();
                dr["max_in_batch"] = str[i].getMAX_IN_BATCH();
                dr["recommend_mash"] = str[i].getRECOMMEND_MASH();
                dr["ibu_gal_per_lb"] = str[i].getIBU_GAL_PER_LB();
                dr["display_amount"] = str[i].getDISPLAY_AMOUNT();
                dr["inventory"] = str[i].getINVENTORY();
                dr["potential"] = str[i].getPOTENTIAL();
                dr["display_color"] = str[i].getDISPLAY_COLOR();

                dt.Rows.Add(dr);
            }

            return dt;
        }

        public List<Hops> ListHops(XmlDocument document)
        {
            List<Hops> listHops = new List<Hops>();

            //string fileName = "xml/hops.xml";
            //XmlDocument document = new XmlDocument();
            //document.Load(fileName);
            XmlNodeList nodes = document.DocumentElement.ChildNodes;
            foreach (XmlNode childnode in nodes)
            {
                Hops hops = new Hops();
                foreach (XmlNode node in childnode.ChildNodes)
                {
                    switch (node.Name)
                    {
                        case "NAME":
                            {
                                hops.setNAME(node.InnerText);
                                break;
                            }
                        case "VERSION":
                            {
                                int verson = 1;
                                try
                                {
                                    verson = Int32.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                hops.setVERSION(verson);
                                break;
                            }
                        case "ORIGIN":
                            {
                                hops.setORIGIN(node.InnerText);
                                break;
                            }
                        case "ALPHA":
                            {
                                float alpha = 0;
                                try
                                {
                                    alpha = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                hops.setALPHA(alpha);
                                break;
                            }
                        case "AMOUNT":
                            {
                                float amount = 0;
                                try
                                {
                                    amount = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                hops.setAMOUNT(amount);
                                break;
                            }
                        case "USE":
                            {
                                hops.setUSE(node.InnerText);
                                break;
                            }
                        case "TIME":
                            {
                                float time = 0;
                                try
                                {
                                    time = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                hops.setTIME(time);
                                break;
                            }
                        case "NOTES":
                            {
                                hops.setNOTES(node.InnerText);
                                break;
                            }
                        case "TYPE":
                            {
                                hops.setTYPE(node.InnerText);
                                break;
                            }
                        case "FORM":
                            {
                                hops.setFORM(node.InnerText);
                                break;
                            }
                        case "BETA":
                            {
                                float beta = 0;
                                try
                                {
                                    beta = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                hops.setBETA(beta);
                                break;
                            }
                        case "HSI":
                            {
                                float hsi = 0;
                                try
                                {
                                    hsi = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                hops.setHSI(hsi);
                                break;
                            }
                        case "DISPLAY_AMOUNT":
                            {
                                hops.setDISPLAY_AMOUNT(node.InnerText);
                                break;
                            }
                        case "INVENTORY":
                            {
                                hops.setINVENTORY(node.InnerText);
                                break;
                            }
                        case "DISPLAY_TIME":
                            {
                                hops.setDISPLAY_TIME(node.InnerText);
                                break;
                            }

                    }

                }
                listHops.Add(hops);
            }
            return listHops;
        }

        public DataTable dataTableHops(List<Hops> str)
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("name", typeof(String));
            dt.Columns.Add("version", typeof(String));
            dt.Columns.Add("origin", typeof(String));
            dt.Columns.Add("alpha", typeof(String));
            dt.Columns.Add("amount", typeof(String));
            dt.Columns.Add("use", typeof(String));
            dt.Columns.Add("time", typeof(String));
            dt.Columns.Add("notes", typeof(String));
            dt.Columns.Add("type", typeof(String));
            dt.Columns.Add("form", typeof(String));
            dt.Columns.Add("beta", typeof(String));
            dt.Columns.Add("hsi", typeof(String));
            dt.Columns.Add("display_amount", typeof(String));
            dt.Columns.Add("inventory", typeof(String));
            dt.Columns.Add("display_time", typeof(String));
            DataRow dr;

            for (int i = 0; i < str.Count; i++)
            {
                dr = dt.NewRow();
                dr["name"] = str[i].getNAME();
                dr["version"] = str[i].getVERSION();
                dr["origin"] = str[i].getORIGIN();
                dr["alpha"] = str[i].getALPHA();
                dr["amount"] = str[i].getAMOUNT();
                dr["use"] = str[i].getUSE();
                dr["time"] = str[i].getTIME();
                dr["notes"] = str[i].getNOTES();
                dr["type"] = str[i].getTYPE();
                dr["form"] = str[i].getFORM();
                dr["beta"] = str[i].getBETA();
                dr["hsi"] = str[i].getHSI();
                dr["display_amount"] = str[i].getDISPLAY_AMOUNT();
                dr["inventory"] = str[i].getINVENTORY();
                dr["display_time"] = str[i].getDISPLAY_TIME();
                dt.Rows.Add(dr);
            }

            return dt;
        }

        public List<Styles> ListStyles(XmlDocument document)
        {
            List<Styles> listStyles = new List<Styles>();

            //string fileName = "xml/style.xml";
            //XmlDocument document = new XmlDocument();
            //document.Load(fileName);
            
            XmlNodeList nodes = document.DocumentElement.ChildNodes;
            foreach (XmlNode childnode in nodes)
            {
                Styles styles = new Styles();
                foreach (XmlNode node in childnode.ChildNodes)
                {
                    switch (node.Name)
                    {
                        case "NAME":
                            {
                                styles.setNAME(node.InnerText);
                                break;
                            }
                        case "VERSION":
                            {
                                int verson = 1;
                                try
                                {
                                    verson = Int32.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                styles.setVERSION(verson);
                                break;
                            }
                        case "CATEGORY":
                            {
                                styles.setCATEGORY(node.InnerText);
                                break;
                            }
                        case "CATEGORY_NUMBER":
                            {
                                int category_number = 0;
                                try
                                {
                                    category_number = Int32.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                styles.setCATEGORY_NUMBER(category_number);
                                break;
                            }
                        case "STYLE_LETTER":
                            {
                                styles.setSTYLE_LETTER(node.InnerText);
                                break;
                            }
                        case "STYLE_GUIDE":
                            {
                                styles.setSTYLE_GUIDE(node.InnerText);
                                break;
                            }
                        case "TYPE":
                            {
                                styles.setTYPE(node.InnerText);
                                break;
                            }
                        case "OG_MIN":
                            {
                                float og_min = 0;
                                try
                                {
                                    og_min = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                styles.setOG_MIN(og_min);
                                break;
                            }
                        case "OG_MAX":
                            {
                                float og_max = 0;
                                try
                                {
                                    og_max = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                styles.setOG_MAX(og_max);
                                break;
                            }
                        case "FG_MIN":
                            {
                                float fg_min = 0;
                                try
                                {
                                    fg_min = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                styles.setFG_MIN(fg_min);
                                break;
                            }
                        case "FG_MAX":
                            {
                                float fg_max = 0;
                                try
                                {
                                    fg_max = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                styles.setFG_MAX(fg_max);
                                break;
                            }
                        case "IBU_MIN":
                            {
                                float ibu_min = 0;
                                try
                                {
                                    ibu_min = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                styles.setIBU_MIN(ibu_min);
                                break;
                            }
                        case "IBU_MAX":
                            {
                                float ibu_max = 0;
                                try
                                {
                                    ibu_max = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                styles.setIBU_MAX(ibu_max);
                                break;
                            }
                        case "COLOR_MIN":
                            {
                                float color_min = 0;
                                try
                                {
                                    color_min = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                styles.setCOLOR_MIN(color_min);
                                break;
                            }
                        case "COLOR_MAX":
                            {
                                float color_max = 0;
                                try
                                {
                                    color_max = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                styles.setCOLOR_MAX(color_max);
                                break;
                            }
                        case "CARB_MIN":
                            {
                                float carb_min = 0;
                                try
                                {
                                    carb_min = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                styles.setCARB_MIN(carb_min);
                                break;
                            }
                        case "CARB_MAX":
                            {
                                float carb_max = 0;
                                try
                                {
                                    carb_max = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                styles.setCARB_MAX(carb_max);
                                break;
                            }
                        case "ABV_MAX":
                            {
                                float abv_max = 0;
                                try
                                {
                                    abv_max = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                styles.setABV_MAX(abv_max);
                                break;
                            }
                        case "ABV_MIN":
                            {
                                float abv_min = 0;
                                try
                                {
                                    abv_min = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                styles.setABV_MIN(abv_min);
                                break;
                            }
                        case "NOTES":
                            {
                                styles.setNOTES(node.InnerText);
                                break;
                            }
                        case "PROFILE":
                            {
                                styles.setPROFILE(node.InnerText);
                                break;
                            }
                        case "INGREDIENTS":
                            {
                                styles.setINGREDIENTS(node.InnerText);
                                break;
                            }
                        case "EXAMPLES":
                            {
                                styles.setEXAMPLES(node.InnerText);
                                break;
                            }
                        case "DISPLAY_OG_MIN":
                            {
                                styles.setDISPLAY_OG_MIN(node.InnerText);
                                break;
                            }
                        case "DISPLAY_OG_MAX":
                            {
                                styles.setDISPLAY_OG_MAX(node.InnerText);
                                break;
                            }
                        case "DISPLAY_FG_MIN":
                            {
                                styles.setDISPLAY_FG_MIN(node.InnerText);
                                break;
                            }
                        case "DISPLAY_FG_MAX":
                            {
                                styles.setDISPLAY_FG_MAX(node.InnerText);
                                break;
                            }
                        case "DISPLAY_COLOR_MIN":
                            {
                                styles.setDISPLAY_COLOR_MIN(node.InnerText);
                                break;
                            }
                        case "DISPLAY_COLOR_MAX":
                            {
                                styles.setDISPLAY_COLOR_MAX(node.InnerText);
                                break;
                            }
                        case "OG_RANGE":
                            {
                                styles.setOG_RANGE(node.InnerText);
                                break;
                            }
                        case "FG_RANGE":
                            {
                                styles.setFG_RANGE(node.InnerText);
                                break;
                            }
                        case "IBU_RANGE":
                            {
                                styles.setIBU_RANGE(node.InnerText);
                                break;
                            }
                        case "CARB_RANGE":
                            {
                                styles.setCARB_RANGE(node.InnerText);
                                break;
                            }
                        case "COLOR_RANGE":
                            {
                                styles.setCOLOR_RANGE(node.InnerText);
                                break;
                            }
                        case "ABV_RANGE":
                            {
                                styles.setABV_RANGE(node.InnerText);
                                break;
                            }
                   

                    }

                }
                listStyles.Add(styles);
            }
            return listStyles;
        }
        public DataTable dataTableStyles(List<Styles> str)
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("name", typeof(String));
            dt.Columns.Add("version", typeof(String));
            dt.Columns.Add("category", typeof(String));
            dt.Columns.Add("category_number", typeof(String));
            dt.Columns.Add("style_letter", typeof(String));
            dt.Columns.Add("style_guide", typeof(String));
            dt.Columns.Add("type", typeof(String));
            dt.Columns.Add("og_min", typeof(String));
            dt.Columns.Add("og_max", typeof(String));
            dt.Columns.Add("fg_min", typeof(String));
            dt.Columns.Add("fg_max", typeof(String));
            dt.Columns.Add("ibu_min", typeof(String));
            dt.Columns.Add("ibu_max", typeof(String));
            dt.Columns.Add("color_min", typeof(String));
            dt.Columns.Add("color_max", typeof(String));
            dt.Columns.Add("carb_min", typeof(String));
            dt.Columns.Add("carb_max", typeof(String));
            dt.Columns.Add("abv_max", typeof(String));
            dt.Columns.Add("abv_min", typeof(String));
            dt.Columns.Add("notes", typeof(String));
            dt.Columns.Add("profile", typeof(String));
            dt.Columns.Add("ingredients", typeof(String));
            dt.Columns.Add("examples", typeof(String));
            dt.Columns.Add("display_og_min", typeof(String));
            dt.Columns.Add("display_og_max", typeof(String));
            dt.Columns.Add("display_fg_min", typeof(String));
            dt.Columns.Add("display_fg_max", typeof(String));
            dt.Columns.Add("display_color_min", typeof(String));
            dt.Columns.Add("display_color_max", typeof(String));
            dt.Columns.Add("og_range", typeof(String));
            dt.Columns.Add("fg_range", typeof(String));
            dt.Columns.Add("ibu_range", typeof(String));
            dt.Columns.Add("carb_range", typeof(String));
            dt.Columns.Add("color_range", typeof(String));
            dt.Columns.Add("abv_range", typeof(String));
            dt.Columns["name"].Caption = "Name";
            DataRow dr;

            for (int i = 0; i < str.Count; i++)
            {
                dr = dt.NewRow();
                dr["name"] = str[i].getNAME();
                dr["version"] = str[i].getVERSION();
                dr["category"] = str[i].getCATEGORY();
                dr["category_number"] = str[i].getCATEGORY_NUMBER();
                dr["style_letter"] = str[i].getSTYLE_LETTER();
                dr["style_guide"] = str[i].getSTYLE_GUIDE();
                dr["type"] = str[i].getTYPE();
                dr["og_min"] = str[i].getOG_MIN();
                dr["og_max"] = str[i].getOG_MAX();
                dr["fg_min"] = str[i].getFG_MIN();
                dr["fg_max"] = str[i].getFG_MAX();
                dr["ibu_min"] = str[i].getIBU_MIN();
                dr["ibu_max"] = str[i].getIBU_MAX();
                dr["color_min"] = str[i].getCOLOR_MIN();
                dr["color_max"] = str[i].getCOLOR_MAX();
                dr["carb_min"] = str[i].getCARB_MIN();
                dr["carb_max"] = str[i].getCARB_MAX();
                dr["abv_max"] = str[i].getABV_MAX();
                dr["abv_min"] = str[i].getABV_MIN();
                dr["notes"] = str[i].getNOTES();
                dr["profile"] = str[i].getPROFILE();
                dr["ingredients"] = str[i].getINGREDIENTS();
                dr["examples"] = str[i].getEXAMPLES();
                dr["display_og_min"] = str[i].getDISPLAY_OG_MIN();
                dr["display_og_max"] = str[i].getDISPLAY_OG_MAX();
                dr["display_fg_min"] = str[i].getDISPLAY_FG_MIN();
                dr["display_fg_max"] = str[i].getDISPLAY_FG_MAX();
                dr["display_color_min"] = str[i].getDISPLAY_COLOR_MIN();
                dr["display_color_max"] = str[i].getDISPLAY_COLOR_MAX();
                dr["og_range"] = str[i].getOG_RANGE();
                dr["fg_range"] = str[i].getFG_RANGE();
                dr["ibu_range"] = str[i].getIBU_RANGE();
                dr["carb_range"] = str[i].getCARB_RANGE();
                dr["color_range"] = str[i].getCOLOR_RANGE();
                dr["abv_range"] = str[i].getABV_RANGE();
                dt.Rows.Add(dr);
            }

            return dt;
        }

        public List<Equipments> ListEquipments(XmlDocument document)
        {
            List<Equipments> listEquipments = new List<Equipments>();

            //string fileName = "xml/equipment.xml";
            //XmlDocument document = new XmlDocument();
            //document.Load(fileName);
            XmlNodeList nodes = document.DocumentElement.ChildNodes;
            foreach (XmlNode childnode in nodes)
            {
                Equipments Equipments = new Equipments();
                foreach (XmlNode node in childnode.ChildNodes)
                {
                    switch (node.Name)
                    {
                        case "NAME":
                            {
                                Equipments.setNAME(node.InnerText);
                                break;
                            }
                        case "VERSION":
                            {
                                int verson = 1;
                                try
                                {
                                    verson = Int32.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Equipments.setVERSION(verson);
                                break;
                            }
                        case "BOIL_SIZE":
                            {
                                float boil_size = 0;
                                try
                                {
                                    boil_size = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Equipments.setBOIL_SIZE(boil_size);
                                break;
                            }
                        case "BATCH_SIZE":
                            {
                                float batch_size = 0;
                                try
                                {
                                    batch_size = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Equipments.setBATCH_SIZE(batch_size);
                                break;
                            }
                        case "TUN_VOLUME":
                            {
                                float tun_volume = 0;
                                try
                                {
                                    tun_volume = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Equipments.setTUN_VOLUME(tun_volume);
                                break;
                            }
                        case "TUN_WEIGHT":
                            {
                                float tun_weight = 0;
                                try
                                {
                                    tun_weight = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Equipments.setTUN_WEIGHT(tun_weight);
                                break;
                            }
                        case "TUN_SPECIFIC_HEAT":
                            {
                                float tun_specific_heat = 0;
                                try
                                {
                                    tun_specific_heat = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Equipments.setTUN_SPECIFIC_HEAT(tun_specific_heat);
                                break;
                            }
                        case "TOP_UP_WATER":
                            {
                                float top_up_water = 0;
                                try
                                {
                                    top_up_water = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Equipments.setTOP_UP_WATER(top_up_water);
                                break;
                            }
                        case "TRUB_CHILLER_LOSS":
                            {
                                float trub_chiller_loss = 0;
                                try
                                {
                                    trub_chiller_loss = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Equipments.setTRUB_CHILLER_LOSS(trub_chiller_loss);
                                break;
                            }
                        case "EVAP_RATE":
                            {
                                float evap_rate = 0;
                                try
                                {
                                    evap_rate = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Equipments.setEVAP_RATE(evap_rate);
                                break;
                            }
                        case "BOIL_TIME":
                            {
                                float boil_time = 0;
                                try
                                {
                                    boil_time = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Equipments.setBOIL_TIME(boil_time);
                                break;
                            }
                        case "CALC_BOIL_VOLUME":
                            {

                                Equipments.setCALC_BOIL_VOLUME(node.InnerText);
                                break;
                            }
                        case "LAUTER_DEADSPACE":
                            {
                                float lauter_deadspace = 0;
                                try
                                {
                                    lauter_deadspace = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Equipments.setLAUTER_DEADSPACE(lauter_deadspace);
                                break;
                            }
                        case "TOP_UP_KETTLE":
                            {
                                float top_up_kettle = 0;
                                try
                                {
                                    top_up_kettle = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Equipments.setTOP_UP_KETTLE(top_up_kettle);
                                break;
                            }
                        case "HOP_UTILIZATION":
                            {
                                Equipments.setHOP_UTILIZATION(node.InnerText);
                                break;
                            }
                        case "NOTES":
                            {
                                Equipments.setNOTES(node.InnerText);
                                break;
                            }
                        case "DISPLAY_BOIL_SIZE":
                            {
                                Equipments.setDISPLAY_BOIL_SIZE(node.InnerText);
                                break;
                            }
                        case "DISPLAY_BATCH_SIZE":
                            {
                                Equipments.setDISPLAY_BATCH_SIZE(node.InnerText);
                                break;
                            }
                        case "DISPLAY_TUN_VOLUME":
                            {
                                Equipments.setDISPLAY_TUN_VOLUME(node.InnerText);
                                break;
                            }
                        case "DISPLAY_TUN_WEIGHT":
                            {
                                Equipments.setDISPLAY_TUN_WEIGHT(node.InnerText);
                                break;
                            }
                        case "DISPLAY_TOP_UP_WATER":
                            {
                                Equipments.setDISPLAY_TOP_UP_WATER(node.InnerText);
                                break;
                            }
                        case "DISPLAY_TRUB_CHILLER_LOSS":
                            {
                                Equipments.setDISPLAY_TRUB_CHILLER_LOSS(node.InnerText);
                                break;
                            }
                        case "DISPLAY_LAUTER_DEADSPACE":
                            {
                                Equipments.setDISPLAY_LAUTER_DEADSPACE(node.InnerText);
                                break;
                            }
                        case "DISPLAY_TOP_UP_KETTLE":
                            {
                                Equipments.setDISPLAY_TOP_UP_KETTLE(node.InnerText);
                                break;
                            }
                    }
                }
                listEquipments.Add(Equipments);
            }

            return listEquipments;
        }

        public DataTable dataTableEquipments(List<Equipments> str)
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("name", typeof(String));
            dt.Columns.Add("version", typeof(String));
            dt.Columns.Add("boil_size", typeof(String));
            dt.Columns.Add("batch_size", typeof(String));
            dt.Columns.Add("tun_volume", typeof(String));
            dt.Columns.Add("tun_weight", typeof(String));
            dt.Columns.Add("tun_specific_head", typeof(String));
            dt.Columns.Add("top_up_water", typeof(String));
            dt.Columns.Add("trub_chiller_loss", typeof(String));
            dt.Columns.Add("evap_rate", typeof(String));
            dt.Columns.Add("boil_time", typeof(String));
            dt.Columns.Add("calc_boil_volume", typeof(String));
            dt.Columns.Add("lauter_deadspace", typeof(String));
            dt.Columns.Add("top_up_kettle", typeof(String));
            dt.Columns.Add("hop_utilization", typeof(String));
            dt.Columns.Add("notes", typeof(String));
            dt.Columns.Add("display_boil_size", typeof(String));
            dt.Columns.Add("display_batch_size", typeof(String));
            dt.Columns.Add("display_tun_volume", typeof(String));
            dt.Columns.Add("display_tun_weight", typeof(String));
            dt.Columns.Add("display_top_up_water", typeof(String));
            dt.Columns.Add("display_trub_chiller_loss", typeof(String));
            dt.Columns.Add("display_lauter_deadspace", typeof(String));
            dt.Columns.Add("display_top_up_kettle", typeof(String));
  
            DataRow dr;

            for (int i = 0; i < str.Count; i++)
            {
                dr = dt.NewRow();
                dr["name"] = str[i].getNAME();
                dr["version"] = str[i].getVERSION();
                dr["boil_size"] = str[i].getBOIL_SIZE();
                dr["batch_size"] = str[i].getBATCH_SIZE();
                dr["tun_volume"] = str[i].getTUN_VOLUME();
                dr["tun_weight"] = str[i].getTUN_WEIGHT();
                dr["tun_specific_head"] = str[i].getTUN_SPECIFIC_HEAT();
                dr["top_up_water"] = str[i].getTOP_UP_WATER();
                dr["trub_chiller_loss"] = str[i].getTRUB_CHILLER_LOSS();
                dr["evap_rate"] = str[i].getEVAP_RATE();
                dr["boil_time"] = str[i].getBOIL_TIME();
                dr["calc_boil_volume"] = str[i].getCALC_BOIL_VOLUME();
                dr["lauter_deadspace"] = str[i].getLAUTER_DEADSPACE();
                dr["top_up_kettle"] = str[i].getTOP_UP_KETTLE();
                dr["hop_utilization"] = str[i].getHOP_UTILIZATION();
                dr["notes"] = str[i].getNOTES();
                dr["display_boil_size"] = str[i].getDISPLAY_BOIL_SIZE();
                dr["display_batch_size"] = str[i].getDISPLAY_BATCH_SIZE();
                dr["display_tun_volume"] = str[i].getDISPLAY_TUN_VOLUME();
                dr["display_tun_weight"] = str[i].getDISPLAY_TUN_WEIGHT();
                dr["display_top_up_water"] = str[i].getDISPLAY_TOP_UP_WATER();
                dr["display_trub_chiller_loss"] = str[i].getDISPLAY_TRUB_CHILLER_LOSS();
                dr["display_lauter_deadspace"] = str[i].getDISPLAY_LAUTER_DEADSPACE();
                dr["display_top_up_kettle"] = str[i].getDISPLAY_TOP_UP_KETTLE();
        
                dt.Rows.Add(dr);
            }

            return dt;
        }

        public List<Miscs> ListMiscs(XmlDocument document)
        {
            List<Miscs> listMiscs = new List<Miscs>();

            //string fileName = "xml/misc.xml";
            //XmlDocument document = new XmlDocument();
            //document.Load(fileName);
            XmlNodeList nodes = document.DocumentElement.ChildNodes;
            foreach (XmlNode childnode in nodes)
            {
                Miscs Miscs = new Miscs();
                foreach (XmlNode node in childnode.ChildNodes)
                {
                    switch (node.Name)
                    {
                        case "NAME":
                            {
                                Miscs.setNAME(node.InnerText);
                                break;
                            }
                        case "VERSION":
                            {
                                int verson = 1;
                                try
                                {
                                    verson = Int32.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Miscs.setVERSION(verson);
                                break;
                            }
                        case "TYPE":
                            {
                                Miscs.setTYPE(node.InnerText);
                                break;
                            }
                        case "USE":
                            {
                                Miscs.setUSE(node.InnerText);
                                break;
                            }
                        case "AMOUNT":
                            {
                                float amount = 0;
                                try
                                {
                                    amount = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Miscs.setAMOUNT(amount);
                                break;
                            }
                        case "TIME":
                            {
                                float time = 0;
                                try
                                {
                                    time = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Miscs.setTIME(time);
                                break;
                            }
                        case "AMOUNT_IS_WEIGHT":
                            {
                                Miscs.setAMOUNT_IS_WEIGHT(node.InnerText);
                                break;
                            }
                        case "USE_FOR":
                            {
                                Miscs.setUSE_FOR(node.InnerText);
                                break;
                            }
                        case "NOTES":
                            {
                                Miscs.setNOTES(node.InnerText);
                                break;
                            }
                        case "DISPLAY_AMOUNT":
                            {
                                Miscs.setDISPLAY_AMOUNT(node.InnerText);
                                break;
                            }
                        case "INVENTORY":
                            {
                                Miscs.setINVENTORY(node.InnerText);
                                break;
                            }
                        case "DISPLAY_TIME":
                            {
                                Miscs.setDISPLAY_TIME(node.InnerText);
                                break;
                            }
                    }
                }
                listMiscs.Add(Miscs);
            }

            return listMiscs;
        }

        public DataTable dataTableMiscs(List<Miscs> str)
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("name", typeof(String));
            dt.Columns.Add("version", typeof(String));
            dt.Columns.Add("type", typeof(String));
            dt.Columns.Add("use", typeof(String));
            dt.Columns.Add("amount", typeof(String));
            dt.Columns.Add("time", typeof(String));
            dt.Columns.Add("amount_is_weight", typeof(String));
            dt.Columns.Add("use_for", typeof(String));
            dt.Columns.Add("notes", typeof(String));
            dt.Columns.Add("display_amount", typeof(String));
            dt.Columns.Add("inventory", typeof(String));
            dt.Columns.Add("display_time", typeof(String));

            DataRow dr;

            for (int i = 0; i < str.Count; i++)
            {
                dr = dt.NewRow();
                dr["name"] = str[i].getNAME();
                dr["version"] = str[i].getVERSION();
                dr["type"] = str[i].getTYPE();
                dr["use"] = str[i].getUSE();
                dr["amount"] = str[i].getAMOUNT();
                dr["time"] = str[i].getTIME();
                dr["amount_is_weight"] = str[i].getAMOUNT_IS_WEIGHT();
                dr["use_for"] = str[i].getUSE_FOR();
                dr["notes"] = str[i].getNOTES();
                dr["display_amount"] = str[i].getDISPLAY_AMOUNT();
                dr["inventory"] = str[i].getINVENTORY();
                dr["display_time"] = str[i].getDISPLAY_TIME();

                dt.Rows.Add(dr);
            }

            return dt;
        }

        public List<Yeast> ListYeasts(XmlDocument document)
        {
            List<Yeast> listYeasts= new List<Yeast>();

            //string fileName = "xml/yeast.xml";
            //XmlDocument document = new XmlDocument();
            //document.Load(fileName);
            XmlNodeList nodes = document.DocumentElement.ChildNodes;
            foreach (XmlNode childnode in nodes)
            {
                Yeast Yeasts = new Yeast();
                foreach (XmlNode node in childnode.ChildNodes)
                {
                    switch (node.Name)
                    {
                        case "NAME":
                            {
                                Yeasts.setNAME(node.InnerText);
                                break;
                            }
                        case "VERSION":
                            {
                                int verson = 1;
                                try
                                {
                                    verson = Int32.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Yeasts.setVERSION(verson);
                                break;
                            }
                        case "TYPE":
                            {
                                Yeasts.setTYPE(node.InnerText);
                                break;
                            }
                        case "FORM":
                            {
                                Yeasts.setFORM(node.InnerText);
                                break;
                            }
                        case "AMOUNT":
                            {
                                float amount = 0;
                                try
                                {
                                    amount = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Yeasts.setAMOUNT(amount);
                                break;
                            }
                        case "AMOUNT_IS_WEIGHT":
                            {
                                Yeasts.setAMOUNT_IS_WEIGHT(node.InnerText);
                                break;
                            }
                        case "LABORATORY":
                            {
                                Yeasts.setLABORATORY(node.InnerText);
                                break;
                            }
                        case "PRODUCT_ID":
                            {
                                Yeasts.setPRODUCT_ID(node.InnerText);
                                break;
                            }
                        case "MIN_TEMPERATURE":
                            {
                                float min_temperature = 0;
                                try
                                {
                                    min_temperature = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Yeasts.setMIN_TEMPERATURE(min_temperature);
                                break;
                            }
                        case "MAX_TEMPERATURE":
                            {
                                float max_temperature = 0;
                                try
                                {
                                    max_temperature = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Yeasts.setMAX_TEMPERATURE(max_temperature);
                                break;
                            }
                        case "FLOCCULATION":
                            {
                                Yeasts.setFLOCCULATION(node.InnerText);
                                break;
                            }
                        case "ATTENUATION":
                            {
                                float attenuation = 0;
                                try
                                {
                                    attenuation = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Yeasts.setATTENUATION(attenuation);
                                break;
                            }
                        case "NOTES":
                            {
                                Yeasts.setNOTES(node.InnerText);
                                break;
                            }
                        case "BEST_FOR":
                            {
                                Yeasts.setBEST_FOR(node.InnerText);
                                break;
                            }
                        case "MAX_REUSE":
                            {
                                int max_reuse = 0;
                                try
                                {
                                    max_reuse = int.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Yeasts.setMAX_REUSE(max_reuse);
                                break;
                            }
                        case "TIMES_CULTURED":
                            {
                                int time_cultured = 0;
                                try
                                {
                                    time_cultured = int.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Yeasts.setTIMES_CULTURED(time_cultured);
                                break;
                            }
                        case "ADD_TO_SECONDARY":
                            {
                                Yeasts.setADD_TO_SECONDARY(node.InnerText);
                                break;
                            }
                        case "DISPLAY_AMOUNT":
                            {
                                Yeasts.setDISPLAY_AMOUNT(node.InnerText);
                                break;
                            }
                        case "DISP_MIN_TEMP":
                            {
                                Yeasts.setDISP_MIN_TEMP(node.InnerText);
                                break;
                            }
                        case "DISP_MAX_TEMP":
                            {
                                Yeasts.setDISP_MAX_TEMP(node.InnerText);
                                break;
                            }
                        case "INVENTORY":
                            {
                                Yeasts.setINVENTORY(node.InnerText);
                                break;
                            }
                        case "CULTURE_DATE":
                            {
                                Yeasts.setCULTURE_DATE(node.InnerText);
                                break;
                            }

                    }
                }
                listYeasts.Add(Yeasts);
            }

            return listYeasts;
        }

        public DataTable dataTableYeasts(List<Yeast> str)
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("name", typeof(String));
            dt.Columns.Add("version", typeof(String));
            dt.Columns.Add("type", typeof(String));
            dt.Columns.Add("form", typeof(String));
            dt.Columns.Add("amount", typeof(String));
            dt.Columns.Add("amount_is_weight", typeof(String));
            dt.Columns.Add("laboratory", typeof(String));
            dt.Columns.Add("product_id", typeof(String));
            dt.Columns.Add("min_temperature", typeof(String));
            dt.Columns.Add("max_temperature", typeof(String));
            dt.Columns.Add("flocculation", typeof(String));
            dt.Columns.Add("attenuation", typeof(String));
            dt.Columns.Add("notes", typeof(String));
            dt.Columns.Add("best_for", typeof(String));
            dt.Columns.Add("max_reuse", typeof(String));
            dt.Columns.Add("times_cultured", typeof(String));
            dt.Columns.Add("add_to_secondary", typeof(String));
            dt.Columns.Add("display_amount", typeof(String));
            dt.Columns.Add("disp_min_temp", typeof(String));
            dt.Columns.Add("disp_max_temp", typeof(String));
            dt.Columns.Add("inventory", typeof(String));
            dt.Columns.Add("culture_date", typeof(String));

            DataRow dr;

            for (int i = 0; i < str.Count; i++)
            {
                dr = dt.NewRow();
                dr["name"] = str[i].getNAME();
                dr["version"] = str[i].getVERSION();
                dr["type"] = str[i].getTYPE();
                dr["form"] = str[i].getFORM();
                dr["amount"] = str[i].getAMOUNT();
                dr["amount_is_weight"] = str[i].getAMOUNT_IS_WEIGHT();
                dr["laboratory"] = str[i].getLABORATORY();
                dr["product_id"] = str[i].getPRODUCT_ID();
                dr["min_temperature"] = str[i].getMIN_TEMPERATURE();
                dr["max_temperature"] = str[i].getMAX_TEMPERATURE();
                dr["flocculation"] = str[i].getFLOCCULATION();
                dr["attenuation"] = str[i].getATTENUATION();
                dr["notes"] = str[i].getNOTES();
                dr["best_for"] = str[i].getBEST_FOR();
                dr["max_reuse"] = str[i].getMAX_REUSE();
                dr["times_cultured"] = str[i].getTIMES_CULTURED();
                dr["add_to_secondary"] = str[i].getADD_TO_SECONDARY();
                dr["display_amount"] = str[i].getDISPLAY_AMOUNT();
                dr["disp_min_temp"] = str[i].getDISP_MIN_TEMP();
                dr["disp_max_temp"] = str[i].getDISP_MAX_TEMP();
                dr["inventory"] = str[i].getINVENTORY();
                dr["culture_date"] = str[i].getCULTURE_DATE();

                dt.Rows.Add(dr);
            }

            return dt;
        }

        public List<Mashs> ListMashs(XmlDocument document)
        {
            List<Mashs> listMashs = new List<Mashs>();
            XmlNodeList nodes = document.DocumentElement.ChildNodes;
            foreach (XmlNode childnode in nodes)
            {
                Mashs Mashs = new Mashs();
                foreach (XmlNode node in childnode.ChildNodes)
                {
                    switch (node.Name)
                    {
                        case "NAME":
                            {
                                Mashs.setNAME(node.InnerText);
                                break;
                            }
                        case "VERSION":
                            {
                                int x = 0;
                                try
                                {
                                    x = int.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Mashs.setVERSION(x);
                                break;
                            }
                        case "GRAIN_TEMP":
                            {
                                float x = 0;
                                try
                                {
                                    x = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Mashs.setGRAIN_TEMP(x);
                                break;
                            }
                        case "TUN_TEMP":
                            {
                                float x = 0;
                                try
                                {
                                    x = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Mashs.setTUN_TEMP(x);
                                break;
                            }
                        case "SPARGE_TEMP":
                            {
                                float x = 0;
                                try
                                {
                                    x = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Mashs.setSPARGE_TEMP(x);
                                break;
                            }
                        case "PH":
                            {
                                float x = 0;
                                try
                                {
                                    x = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Mashs.setPH(x);
                                break;
                            }
                        case "TUN_WEIGHT":
                            {
                                float x = 0;
                                try
                                {
                                    x = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Mashs.setTUN_WEIGHT(x);
                                break;
                            }
                        case "TUN_SPECIFIC_HEAT":
                            {
                                float x = 0;
                                try
                                {
                                    x = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Mashs.setTUN_SPECIFIC_HEAT(x);
                                break;
                            }
                        case "EQUIP_ADJUST":
                            {
                                Mashs.setEQUIP_ADJUST(node.InnerText);
                                break;
                            }
                        case "NOTES":
                            {
                                Mashs.setNOTES(node.InnerText);
                                break;
                            }
                        case "DISPLAY_GRAIN_TEMP":
                            {
                                Mashs.setDISPLAY_GRAIN_TEMP(node.InnerText);
                                break;
                            }
                        case "DISPLAY_TUN_TEMP":
                            {
                                float x = 0;
                                try
                                {
                                    x = float.Parse(node.InnerText);
                                }
                                catch (Exception) { }
                                Mashs.setDISPLAY_TUN_TEMP(x);
                                break;
                            }
                        case "DISPLAY_SPARGE_TEMP":
                            {
                                Mashs.setDISPLAY_SPARGE_TEMP(node.InnerText);
                                break;
                            }
                        case "DISPLAY_TUN_WEIGHT":
                            {
                                Mashs.setDISPLAY_TUN_WEIGHT(node.InnerText);
                                break;
                            }
                        case "MASH_STEPS":
                            {
                                listMashStep MASH_STEP = new listMashStep();
                                List<Mash_step> ListMash_Step = new List<Mash_step>();
                                foreach (XmlNode mash_stepnode in node.ChildNodes)
                                {
                                    Mash_step mash_step = new Mash_step();
                                    foreach (XmlNode step in mash_stepnode.ChildNodes)
                                    {
                                        switch (step.Name)
                                        {
                                            case "NAME":
                                                {
                                                    mash_step.setNAME(step.InnerText);
                                                    break;
                                                }
                                            case "VERSION":
                                                {
                                                    int x = 0;
                                                    try
                                                    {
                                                        x = int.Parse(step.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    mash_step.setVERSION(x);
                                                    break;
                                                }
                                            case "TYPE":
                                                {
                                                    mash_step.setTYPE(step.InnerText);
                                                    break;
                                                }
                                            case "INFUSE_AMOUNT":
                                                {
                                                    float x = 0;
                                                    try
                                                    {
                                                        x = float.Parse(step.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    mash_step.setINFUSE_AMOUNT(x);
                                                    break;
                                                }
                                            case "STEP_TIME":
                                                {
                                                    int x = 0;
                                                    try
                                                    {
                                                        x = int.Parse(step.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    mash_step.setSTEP_TIME(x);
                                                    break;
                                                }
                                            case "STEP_TEMP":
                                                {
                                                    int x = 0;
                                                    try
                                                    {
                                                        x = int.Parse(step.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    mash_step.setSTEP_TEMP(x);
                                                    break;
                                                }
                                            case "RAMP_TIME":
                                                {
                                                    int x = 0;
                                                    try
                                                    {
                                                        x = int.Parse(step.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    mash_step.setRAMP_TIME(x);
                                                    break;
                                                }
                                            case "END_TEMP":
                                                {
                                                    float x = 0;
                                                    try
                                                    {
                                                        x = float.Parse(step.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    mash_step.setEND_TEMP(x);
                                                    break;
                                                }
                                            case "DESCRIPTION":
                                                {
                                                    mash_step.setDESCRIPTION(step.InnerText);
                                                    break;
                                                }
                                            case "WATER_GRAIN_RATIO":
                                                {
                                                    float x = 0;
                                                    try
                                                    {
                                                        x = float.Parse(step.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    mash_step.setWATER_GRAIN_RATIO(x);
                                                    break;
                                                }
                                            case "DECOCTION_AMT":
                                                {
                                                    mash_step.setDECOCTION_AMT(step.InnerText);
                                                    break;
                                                }
                                            case "INFUSE_TEMP":
                                                {
                                                    mash_step.setINFUSE_TEMP(step.InnerText);
                                                    break;
                                                }
                                            case "DISPLAY_STEP_TEMP":
                                                {
                                                    mash_step.setDISPLAY_STEP_TEMP(step.InnerText);
                                                    break;
                                                }
                                            case "DISPLAY_INFUSE_AMT":
                                                {
                                                    mash_step.setDISPLAY_INFUSE_AMT(step.InnerText);
                                                    break;
                                                }
                                        }
                                    }
                                    ListMash_Step.Add(mash_step);
                                }
                                MASH_STEP.setMASH_STEP(ListMash_Step);
                                Mashs.setMASH_STEPS(MASH_STEP);
                                break;
                            }
                    }
                }
                listMashs.Add(Mashs);
            }

            return listMashs;
        }

        public DataTable dataTableMash(List<Mashs> str)
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("name", typeof(String));
            dt.Columns.Add("version", typeof(String));
            dt.Columns.Add("grain_temp", typeof(String));
            dt.Columns.Add("tun_temp", typeof(String));
            dt.Columns.Add("sparge_temp", typeof(String));
            dt.Columns.Add("ph", typeof(String));
            dt.Columns.Add("tun_weight", typeof(String));
            dt.Columns.Add("tun_specific_heat", typeof(String));
            dt.Columns.Add("equip_adjust", typeof(String));
            dt.Columns.Add("notes", typeof(String));
            dt.Columns.Add("display_grain_temp", typeof(String));
            dt.Columns.Add("display_tun_temp", typeof(String));
            dt.Columns.Add("display_sparge_temp", typeof(String));
            dt.Columns.Add("display_tun_weight", typeof(String));
            dt.Columns.Add("mash_steps", typeof(listMashStep));

            DataRow dr;

            for (int i = 0; i < str.Count; i++)
            {
                dr = dt.NewRow();
                dr["name"] = str[i].getNAME();
                dr["version"] = str[i].getVERSION();
                dr["grain_temp"] = str[i].getGRAIN_TEMP();
                dr["tun_temp"] = str[i].getTUN_TEMP();
                dr["sparge_temp"] = str[i].getSPARGE_TEMP();
                dr["ph"] = str[i].getPH();
                dr["tun_weight"] = str[i].getTUN_WEIGHT();
                dr["tun_specific_heat"] = str[i].getTUN_SPECIFIC_HEAT();
                dr["equip_adjust"] = str[i].getEQUIP_ADJUST();
                dr["notes"] = str[i].getNOTES();
                dr["display_grain_temp"] = str[i].getDISPLAY_GRAIN_TEMP();
                dr["display_tun_temp"] = str[i].getDISPLAY_TUN_TEMP();
                dr["display_sparge_temp"] = str[i].getDISPLAY_SPARGE_TEMP();
                dr["display_tun_weight"] = str[i].getDISPLAY_TUN_WEIGHT();
                dr["mash_steps"] = str[i].getMASH_STEPS();

                dt.Rows.Add(dr);
            }

            return dt;
        }

        public List<Mash_step> ListMashStep(XmlDocument document)
        {
            List<Mash_step> listMashStep = new List<Mash_step>();
            XmlNodeList nodes = document.DocumentElement.ChildNodes;
            foreach (XmlNode childnode in nodes)
            {
                //Mashs Mashs = new Mashs();
                foreach (XmlNode node in childnode.ChildNodes)
                {
                    switch (node.Name)
                    {
                        case "MASH_STEPS":
                            {
                                //List<Mash_step> ListMash_Step = new List<Mash_step>();
                                foreach (XmlNode mash_stepnode in node.ChildNodes)
                                {
                                    Mash_step mash_step = new Mash_step();
                                    foreach (XmlNode step in mash_stepnode.ChildNodes)
                                    {
                                        switch (step.Name)
                                        {
                                            case "NAME":
                                                {
                                                    mash_step.setNAME(step.InnerText);
                                                    break;
                                                }
                                            case "VERSION":
                                                {
                                                    int x = 0;
                                                    try
                                                    {
                                                        x = int.Parse(step.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    mash_step.setVERSION(x);
                                                    break;
                                                }
                                            case "TYPE":
                                                {
                                                    mash_step.setTYPE(step.InnerText);
                                                    break;
                                                }
                                            case "INFUSE_AMOUNT":
                                                {
                                                    float x = 0;
                                                    try
                                                    {
                                                        x = float.Parse(step.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    mash_step.setINFUSE_AMOUNT(x);
                                                    break;
                                                }
                                            case "STEP_TIME":
                                                {
                                                    int x = 0;
                                                    try
                                                    {
                                                        x = int.Parse(step.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    mash_step.setSTEP_TIME(x);
                                                    break;
                                                }
                                            case "STEP_TEMP":
                                                {
                                                    int x = 0;
                                                    try
                                                    {
                                                        x = int.Parse(step.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    mash_step.setSTEP_TEMP(x);
                                                    break;
                                                }
                                            case "RAMP_TIME":
                                                {
                                                    int x = 0;
                                                    try
                                                    {
                                                        x = int.Parse(step.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    mash_step.setRAMP_TIME(x);
                                                    break;
                                                }
                                            case "END_TEMP":
                                                {
                                                    float x = 0;
                                                    try
                                                    {
                                                        x = float.Parse(step.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    mash_step.setEND_TEMP(x);
                                                    break;
                                                }
                                            case "DESCRIPTION":
                                                {
                                                    mash_step.setDESCRIPTION(step.InnerText);
                                                    break;
                                                }
                                            case "WATER_GRAIN_RATIO":
                                                {
                                                    float x = 0;
                                                    try
                                                    {
                                                        x = float.Parse(step.InnerText);
                                                    }
                                                    catch (Exception) { }
                                                    mash_step.setWATER_GRAIN_RATIO(x);
                                                    break;
                                                }
                                            case "DECOCTION_AMT":
                                                {
                                                    mash_step.setDECOCTION_AMT(step.InnerText);
                                                    break;
                                                }
                                            case "INFUSE_TEMP":
                                                {
                                                    mash_step.setINFUSE_TEMP(step.InnerText);
                                                    break;
                                                }
                                            case "DISPLAY_STEP_TEMP":
                                                {
                                                    mash_step.setDISPLAY_STEP_TEMP(step.InnerText);
                                                    break;
                                                }
                                            case "DISPLAY_INFUSE_AMT":
                                                {
                                                    mash_step.setDISPLAY_INFUSE_AMT(step.InnerText);
                                                    break;
                                                }
                                        }
                                    }
                                    listMashStep.Add(mash_step);
                                }
                                break;
                        }
                    }
                }
            }
            return listMashStep;
        }

        public DataTable dataTableMash_Step(List<Mash_step> str)
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("name", typeof(String));
            dt.Columns.Add("version", typeof(String));
            dt.Columns.Add("type", typeof(String));
            dt.Columns.Add("infuse_amount", typeof(String));
            dt.Columns.Add("step_time", typeof(String));
            dt.Columns.Add("step_temp", typeof(String));
            dt.Columns.Add("ramp_time", typeof(String));
            dt.Columns.Add("end_temp", typeof(String));
            dt.Columns.Add("description", typeof(String));
            dt.Columns.Add("water_grain_ratio", typeof(String));
            dt.Columns.Add("decoction_amt", typeof(String));
            dt.Columns.Add("infuse_temp", typeof(String));
            dt.Columns.Add("display_step_temp", typeof(String));
            dt.Columns.Add("display_infuse_amt", typeof(String));

            DataRow dr;

            for (int i = 0; i < str.Count; i++)
            {
                dr = dt.NewRow();
                dr["name"] = str[i].getNAME();
                dr["version"] = str[i].getVERSION();
                dr["type"] = str[i].getTYPE();
                dr["infuse_amount"] = str[i].getINFUSE_AMOUNT();
                dr["step_time"] = str[i].getSTEP_TIME();
                dr["step_temp"] = str[i].getSTEP_TEMP();
                dr["ramp_time"] = str[i].getRAMP_TIME();
                dr["end_temp"] = str[i].getEND_TEMP();
                dr["description"] = str[i].getDESCRIPTION();
                dr["water_grain_ratio"] = str[i].getWATER_GRAIN_RATIO();
                dr["decoction_amt"] = str[i].getDECOCTION_AMT();
                dr["infuse_temp"] = str[i].getINFUSE_TEMP();
                dr["display_step_temp"] = str[i].getDISPLAY_STEP_TEMP();
                dr["display_infuse_amt"] = str[i].getDISPLAY_INFUSE_AMT();

                dt.Rows.Add(dr);
            }

            return dt;
        }

      
    }
}
